Guest Skippybox Posted September 16, 2008 Posted September 16, 2008 How would someone duplicate some or all of the contents of several folders, within those same folders all at once. What kind of program could I use for this, preferrably freeware? As an example, say I have three folders named 1, 2, and 3. Folder 1 contains files A, B and Z, folder 2 contains files C, D and Z, and folder 3 contains files E, F and Z: 1> A, B, Z 2> C, D, Z 3> E, F, Z How would you select all at once, the six files A through F, in the three folders 1 through 3, and end up with the following: 1> A, B, Copy of A, Copy of B, Z 2> C, D, Copy of C, Copy of D, Z 3> E, F, Copy of E, Copy of F, Z I'm looking for something that makes this duplication task easier, as this would be tedious for several hundred folders. Thanks in advance!
Guest PA Bear [MS MVP] Posted September 16, 2008 Posted September 16, 2008 Re: Duplicating Files Perhaps http://en.wikipedia.org/wiki/SyncToy ?? Skippybox wrote: > How would someone duplicate some or all of the contents of several > folders, > within those same folders all at once. What kind of program could I use > for > this, preferrably freeware? > > As an example, say I have three folders named 1, 2, and 3. Folder 1 > contains files A, B and Z, folder 2 contains files C, D and Z, and folder > 3 > contains files E, F and Z: > > 1> A, B, Z > 2> C, D, Z > 3> E, F, Z > > How would you select all at once, the six files A through F, in the three > folders 1 through 3, and end up with the following: > > 1> A, B, Copy of A, Copy of B, Z > 2> C, D, Copy of C, Copy of D, Z > 3> E, F, Copy of E, Copy of F, Z > > I'm looking for something that makes this duplication task easier, as this > would be tedious for several hundred folders. Thanks in advance!
Guest Pegasus \(MVP\) Posted September 16, 2008 Posted September 16, 2008 Re: Duplicating Files "Skippybox" <Skippybox@discussions.microsoft.com> wrote in message news:AB1290FD-557B-4CD3-8A17-C6FB85935B77@microsoft.com... > How would someone duplicate some or all of the contents of several > folders, > within those same folders all at once. What kind of program could I use > for > this, preferrably freeware? > > As an example, say I have three folders named 1, 2, and 3. Folder 1 > contains files A, B and Z, folder 2 contains files C, D and Z, and folder > 3 > contains files E, F and Z: > > 1> A, B, Z > 2> C, D, Z > 3> E, F, Z > > How would you select all at once, the six files A through F, in the three > folders 1 through 3, and end up with the following: > > 1> A, B, Copy of A, Copy of B, Z > 2> C, D, Copy of C, Copy of D, Z > 3> E, F, Copy of E, Copy of F, Z > > I'm looking for something that makes this duplication task easier, as this > would be tedious for several hundred folders. Thanks in advance! This seems a rather strange request . . . Anyway, you could use this batch file: @echo off set Source=d:\test folder for /F %%a in ('dir /ad /b "%Source%"') do call :Sub %%a goto :eof :Sub for /F %%b in ('dir /a-d /b "%Source%\%*\*.*"') do ^ echo copy /y "%Source%\%*\%%b" "%Source%\%*\Copy of %%b" pause To activate the batch file, remove the word "pause" at the end and change the line just above from echo copy /y "%Source%\%*\%%b" "%Source%\%*\Copy of %%b" to copy /y "%Source%\%*\%%b" "%Source%\%*\Copy of %%b"
Guest Skippybox Posted September 16, 2008 Posted September 16, 2008 Re: Duplicating Files I appreciate your suggestion PA Bear [MS MVP]. I have SyncToy already, but it would not be useful for my task. For one, I am not trying to synchronize two folders. I am simply trying to copy select files within folders and paste them in those same folders, but do it in batch. What I want to do is similar to a batch rename. However, instead of overwriting the files with new names, I want to make new copies of the files in the source folders. SyncToy cannot maintain two copies of a changed file in the same folder. It is also impossible to use the same folder for both the left and right in SyncToy. Even if I somehow used SyncToy, I think I would have a problem combining the folders. It's just not usable for this. Do you know of a better solution? Thanks! "PA Bear [MS MVP]" wrote: > Perhaps http://en.wikipedia.org/wiki/SyncToy ?? > > Skippybox wrote: > > How would someone duplicate some or all of the contents of several > > folders, > > within those same folders all at once. What kind of program could I use > > for > > this, preferrably freeware? > > > > As an example, say I have three folders named 1, 2, and 3. Folder 1 > > contains files A, B and Z, folder 2 contains files C, D and Z, and folder > > 3 > > contains files E, F and Z: > > > > 1> A, B, Z > > 2> C, D, Z > > 3> E, F, Z > > > > How would you select all at once, the six files A through F, in the three > > folders 1 through 3, and end up with the following: > > > > 1> A, B, Copy of A, Copy of B, Z > > 2> C, D, Copy of C, Copy of D, Z > > 3> E, F, Copy of E, Copy of F, Z > > > > I'm looking for something that makes this duplication task easier, as this > > would be tedious for several hundred folders. Thanks in advance! > >
Guest Skippybox Posted September 16, 2008 Posted September 16, 2008 Re: Duplicating Files I'm trying to rename select files, but I don't want to actually rename them. I want to retain the original named files, but create a second copy of them in the same folder that can be renamed in another program. Most batch renamer programs either output a copy of all the files to another folder or overwrite the original files, neither of which I want. So, that is why I need to create copies in the same folders, but for several folders in several locations at once. Impossible? I tried your batch file Pegasus (MVP), but I couldn't get it to work. I'm afraid I am not familiar with the syntax of them. Unless you want to explain it, I would prefer to use a copy/duplication program that may be available. I found a program caled FileBoss which looks like it probably could do what I want, but I was hoping for freeware. Any ideas? Thank-you. "Pegasus (MVP)" wrote: > > "Skippybox" <Skippybox@discussions.microsoft.com> wrote in message > news:AB1290FD-557B-4CD3-8A17-C6FB85935B77@microsoft.com... > > How would someone duplicate some or all of the contents of several > > folders, > > within those same folders all at once. What kind of program could I use > > for > > this, preferrably freeware? > > > > As an example, say I have three folders named 1, 2, and 3. Folder 1 > > contains files A, B and Z, folder 2 contains files C, D and Z, and folder > > 3 > > contains files E, F and Z: > > > > 1> A, B, Z > > 2> C, D, Z > > 3> E, F, Z > > > > How would you select all at once, the six files A through F, in the three > > folders 1 through 3, and end up with the following: > > > > 1> A, B, Copy of A, Copy of B, Z > > 2> C, D, Copy of C, Copy of D, Z > > 3> E, F, Copy of E, Copy of F, Z > > > > I'm looking for something that makes this duplication task easier, as this > > would be tedious for several hundred folders. Thanks in advance! > > This seems a rather strange request . . . Anyway, you could use this batch > file: > @echo off > set Source=d:\test folder > for /F %%a in ('dir /ad /b "%Source%"') do call :Sub %%a > goto :eof > > :Sub > for /F %%b in ('dir /a-d /b "%Source%\%*\*.*"') do ^ > echo copy /y "%Source%\%*\%%b" "%Source%\%*\Copy of %%b" > pause > > To activate the batch file, remove the word "pause" at the end and change > the line just above from > > echo copy /y "%Source%\%*\%%b" "%Source%\%*\Copy of %%b" > to > copy /y "%Source%\%*\%%b" "%Source%\%*\Copy of %%b" > > >
Guest Pegasus \(MVP\) Posted September 16, 2008 Posted September 16, 2008 Re: Duplicating Files Sorry, unless you post your modified version of the batch file plus a full explanation of what exactly happened, I am unable to tell you what's happened. Your reply "..couldn't get it to work" does not tell me anything. Suffice it to say that I tested the program on my machine and it works as expected. Here is a brief explanation of each line of code: set Source=d:\test folder In this line you tell the program where the parent folder resides. The parent folder is the home for your various subfolders containing the files to be copied. for /F %%a in ('dir /ad /b "%Source%"') do call :Sub %%a This line picks up the various subfolders and tells the subroutine to process one at a time goto :eof This line ends the main part of the batch file. :Sub This line says that we're now in a subroutine. for /F %%b in ('dir /a-d /b "%Source%\%*\*.*"') do ^ echo copy /y "%Source%\%*\%%b" "%Source%\%*\Copy of %%b" This is actually one long line, as indicated by the ^ continuation character. It picks up one file at the time from the nominated folder and creates a copy of it under a new name, by preceding its original name with "Copy of". The word "echo" prevents anything permanent from happening, thus forcing the batch file into a demo mode. To activate the batch file, this double line must look like so: for /F %%b in ('dir /a-d /b "%Source%\%*\*.*"') do ^ copy /y "%Source%\%*\%%b" "%Source%\%*\Copy of %%b" pause This line pauses the batch file so that you can see what's happening. If you're not familiar with advanced batch files then there is not much point in me explaining the exact syntax of each line. Just copy and paste them as they are, and set the "Source" to suit your own environment. "Skippybox" <Skippybox@discussions.microsoft.com> wrote in message news:6AB78AB2-DAA7-4A80-AA65-FCBE057FB541@microsoft.com... > I'm trying to rename select files, but I don't want to actually rename > them. > I want to retain the original named files, but create a second copy of > them > in the same folder that can be renamed in another program. Most batch > renamer programs either output a copy of all the files to another folder > or > overwrite the original files, neither of which I want. So, that is why I > need to create copies in the same folders, but for several folders in > several > locations at once. Impossible? I tried your batch file Pegasus (MVP), > but I > couldn't get it to work. I'm afraid I am not familiar with the syntax of > them. Unless you want to explain it, I would prefer to use a > copy/duplication program that may be available. I found a program caled > FileBoss which looks like it probably could do what I want, but I was > hoping > for freeware. Any ideas? Thank-you. > > "Pegasus (MVP)" wrote: > >> >> "Skippybox" <Skippybox@discussions.microsoft.com> wrote in message >> news:AB1290FD-557B-4CD3-8A17-C6FB85935B77@microsoft.com... >> > How would someone duplicate some or all of the contents of several >> > folders, >> > within those same folders all at once. What kind of program could I >> > use >> > for >> > this, preferrably freeware? >> > >> > As an example, say I have three folders named 1, 2, and 3. Folder 1 >> > contains files A, B and Z, folder 2 contains files C, D and Z, and >> > folder >> > 3 >> > contains files E, F and Z: >> > >> > 1> A, B, Z >> > 2> C, D, Z >> > 3> E, F, Z >> > >> > How would you select all at once, the six files A through F, in the >> > three >> > folders 1 through 3, and end up with the following: >> > >> > 1> A, B, Copy of A, Copy of B, Z >> > 2> C, D, Copy of C, Copy of D, Z >> > 3> E, F, Copy of E, Copy of F, Z >> > >> > I'm looking for something that makes this duplication task easier, as >> > this >> > would be tedious for several hundred folders. Thanks in advance! >> >> This seems a rather strange request . . . Anyway, you could use this >> batch >> file: >> @echo off >> set Source=d:\test folder >> for /F %%a in ('dir /ad /b "%Source%"') do call :Sub %%a >> goto :eof >> >> :Sub >> for /F %%b in ('dir /a-d /b "%Source%\%*\*.*"') do ^ >> echo copy /y "%Source%\%*\%%b" "%Source%\%*\Copy of %%b" >> pause >> >> To activate the batch file, remove the word "pause" at the end and change >> the line just above from >> >> echo copy /y "%Source%\%*\%%b" "%Source%\%*\Copy of %%b" >> to >> copy /y "%Source%\%*\%%b" "%Source%\%*\Copy of %%b" >> >> >>
Guest Skippybox Posted September 16, 2008 Posted September 16, 2008 Re: Duplicating Files OK, I fiddled with my folders and managed to get your batch file to run. However, I discovered several problems. Initially, I got 'File Not Found', and figured out that the batch file must not be able to process more than one level of a directory. Upon changing it to a single level, the batch ran and finished. But, when I looked in the folders, only certain files had copies. I realized that the batch file only could make copies of files without spaces in their names, which isn't very useful. Thank you for explaining the batch file a little more. I think it is a nice start, but would require more work. Although I'm not sure I want to use such a basic tool for what could be a rather complex copying operation. I would feel much more comfortable using something that is easy to use and more capable under varying conditions. I really wouldn't have time building a mini-program. As it stands, there is no way to select the files I want copied, the batch file tries to copy the entire folders, which is only one possiblity. Thanks for your solution though, it was quite a good try! "Pegasus (MVP)" wrote: > Sorry, unless you post your modified version of the batch file plus a full > explanation of what exactly happened, I am unable to tell you what's > happened. Your reply "..couldn't get it to work" does not tell me anything. > Suffice it to say that I tested the program on my machine and it works as > expected. > > Here is a brief explanation of each line of code: > > set Source=d:\test folder > In this line you tell the program where the parent folder resides. The > parent folder is the home for your various subfolders containing the files > to be copied. > > for /F %%a in ('dir /ad /b "%Source%"') do call :Sub %%a > This line picks up the various subfolders and tells the subroutine to > process one at a time > > goto :eof > This line ends the main part of the batch file. > > :Sub > This line says that we're now in a subroutine. > > for /F %%b in ('dir /a-d /b "%Source%\%*\*.*"') do ^ > echo copy /y "%Source%\%*\%%b" "%Source%\%*\Copy of %%b" > This is actually one long line, as indicated by the ^ continuation > character. It picks up one file at the time from the nominated folder and > creates a copy of it under a new name, by preceding its original name with > "Copy of". The word "echo" prevents anything permanent from happening, thus > forcing the batch file into a demo mode. To activate the batch file, this > double line must look like so: > for /F %%b in ('dir /a-d /b "%Source%\%*\*.*"') do ^ > copy /y "%Source%\%*\%%b" "%Source%\%*\Copy of %%b" > > pause > This line pauses the batch file so that you can see what's happening. > > If you're not familiar with advanced batch files then there is not much > point in me explaining the exact syntax of each line. Just copy and paste > them as they are, and set the "Source" to suit your own environment. > > > "Skippybox" <Skippybox@discussions.microsoft.com> wrote in message > news:6AB78AB2-DAA7-4A80-AA65-FCBE057FB541@microsoft.com... > > I'm trying to rename select files, but I don't want to actually rename > > them. > > I want to retain the original named files, but create a second copy of > > them > > in the same folder that can be renamed in another program. Most batch > > renamer programs either output a copy of all the files to another folder > > or > > overwrite the original files, neither of which I want. So, that is why I > > need to create copies in the same folders, but for several folders in > > several > > locations at once. Impossible? I tried your batch file Pegasus (MVP), > > but I > > couldn't get it to work. I'm afraid I am not familiar with the syntax of > > them. Unless you want to explain it, I would prefer to use a > > copy/duplication program that may be available. I found a program caled > > FileBoss which looks like it probably could do what I want, but I was > > hoping > > for freeware. Any ideas? Thank-you. > > > > "Pegasus (MVP)" wrote: > > > >> > >> "Skippybox" <Skippybox@discussions.microsoft.com> wrote in message > >> news:AB1290FD-557B-4CD3-8A17-C6FB85935B77@microsoft.com... > >> > How would someone duplicate some or all of the contents of several > >> > folders, > >> > within those same folders all at once. What kind of program could I > >> > use > >> > for > >> > this, preferrably freeware? > >> > > >> > As an example, say I have three folders named 1, 2, and 3. Folder 1 > >> > contains files A, B and Z, folder 2 contains files C, D and Z, and > >> > folder > >> > 3 > >> > contains files E, F and Z: > >> > > >> > 1> A, B, Z > >> > 2> C, D, Z > >> > 3> E, F, Z > >> > > >> > How would you select all at once, the six files A through F, in the > >> > three > >> > folders 1 through 3, and end up with the following: > >> > > >> > 1> A, B, Copy of A, Copy of B, Z > >> > 2> C, D, Copy of C, Copy of D, Z > >> > 3> E, F, Copy of E, Copy of F, Z > >> > > >> > I'm looking for something that makes this duplication task easier, as > >> > this > >> > would be tedious for several hundred folders. Thanks in advance! > >> > >> This seems a rather strange request . . . Anyway, you could use this > >> batch > >> file: > >> @echo off > >> set Source=d:\test folder > >> for /F %%a in ('dir /ad /b "%Source%"') do call :Sub %%a > >> goto :eof > >> > >> :Sub > >> for /F %%b in ('dir /a-d /b "%Source%\%*\*.*"') do ^ > >> echo copy /y "%Source%\%*\%%b" "%Source%\%*\Copy of %%b" > >> pause > >> > >> To activate the batch file, remove the word "pause" at the end and change > >> the line just above from > >> > >> echo copy /y "%Source%\%*\%%b" "%Source%\%*\Copy of %%b" > >> to > >> copy /y "%Source%\%*\%%b" "%Source%\%*\Copy of %%b" > >> > >> > >> > > >
Recommended Posts