Batch files

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
dusan
Junior Member
Junior Member
Posts: 15
Joined: 2003-04-04, 15:10 UTC
Location: Slovakia

Batch files

Post by *dusan »

Hi there,

Can you tell me a quick way how to copy files from multiple folders into one folder (rename if necessary) and than copy back to the same folder structure somewhere else please ?

I got lots of files in hundred of folders, but I need to copy them into one folder send it out for processing and once received - recreate the same folder structure.

Thank you for your help

Dusan
chasbas
Junior Member
Junior Member
Posts: 52
Joined: 2003-02-06, 16:01 UTC
Location: New Jersey

Post by *chasbas »

Dusan:

The best solution for this depends on a lot of factors.

I assume all the filenames are unique, so they can coexist in one directory.

Are the directory names always the same? How about the filenames? Is there anything distinguishing about the filenames that would permit logic to determine which directory they should go in?

Can you rename the outgoing file before processing (say, to "directory-names-separated-by-dashes-filename.xxx") or do they have to stay the way they are?

A real life example of what you're trying to do would be helpful.

chas
User avatar
dusan
Junior Member
Junior Member
Posts: 15
Joined: 2003-04-04, 15:10 UTC
Location: Slovakia

Post by *dusan »

chasbas wrote:Dusan:

The best solution for this depends on a lot of factors.
sdfs

I assume all the filenames are unique, so they can coexist in one directory.

Are the directory names always the same? How about the filenames? Is there anything distinguishing about the filenames that would permit logic to determine which directory they should go in?

Can you rename the outgoing file before processing (say, to "directory-names-separated-by-dashes-filename.xxx") or do they have to stay the way they are?

A real life example of what you're trying to do would be helpful.

chas
Hi Chas,

Let's say I want copy all the files from Windows directory and subdirectories to one folder.
* I could use CTRL+B and CTRL+M in order to rename them to whatever I want and copy them to one folder, but I dont know how to copy them back to the directories.

*I was thinking of some extra list file where all the files would have their relative paths and a new unique name for each file. And use some fancy DOS batch command perhaps ?

or there might be better ideas ?

thanks
Dusan
User avatar
white
Power Member
Power Member
Posts: 5784
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

ZIP them in separate archives?
ay222
Junior Member
Junior Member
Posts: 42
Joined: 2003-11-26, 20:06 UTC

Post by *ay222 »

2dusan
dusan wrote
Let's say I want copy all the files from Windows directory and subdirectories to one folder.
* I could use CTRL+B and CTRL+M in order to rename them to whatever I want and copy them to one folder, but I dont know how to copy them back to the directories.
if you do so then every file will renamed in its folder so you can copy them to one folder and don't care about returning them back.
can you give us a reason for copying all file to one folder and then return them again to the original folders?
User avatar
dusan
Junior Member
Junior Member
Posts: 15
Joined: 2003-04-04, 15:10 UTC
Location: Slovakia

Post by *dusan »

ay222 wrote: can you give us a reason for copying all file to one folder and then return them again to the original folders?
I've got cca. 2000 XMLs in 250 folders where some of the files are stored in the subfolders depth 6-8. I need to split and send those files to 5 people (who don't use TC) for editing. They complain that it's difficult to navigate through such complex folder structure.
XMLs can't be glued and they don't like search option in Windows Explorer

My idea was to copy all the files to 1 folder send them for editing and recreate folder structure at the end.

Dusan
ay222
Junior Member
Junior Member
Posts: 42
Joined: 2003-11-26, 20:06 UTC

Post by *ay222 »

dusan wrote:
ay222 wrote: can you give us a reason for copying all file to one folder and then return them again to the original folders?
I've got cca. 2000 XMLs in 250 folders where some of the files are stored in the subfolders depth 6-8. I need to split and send those files to 5 people (who don't use TC) for editing. They complain that it's difficult to navigate through such complex folder structure.
XMLs can't be glued and they don't like search option in Windows Explorer

My idea was to copy all the files to 1 folder send them for editing and recreate folder structure at the end.

Dusan
Hi
Now i understand your need, and it is difficult to achieve this easily by TC or any other program. anyway i have an idea can solve your problem but it need many precautions to success
1- goto the folder contain your xml files and execute CTRL+B
2- sort the files list by name (Ascending) - important
3- select all the files and execute the command cm_CopyFullNamesToClip
4- Open Notepad and Paste
5- save the file with any name let us say "Destination.txt"

6- goto the folder contain your copy of xml files
7- sort the files list by name (Ascending) - important
8- select all the files and execute the command cm_CopyFullNamesToClip
9- Open Notepad and Paste
10- save the file with any name let us say "Source.txt"

after doing the above steps you will have two files in each line of them contain the same file name but diferent path, so if you have an experience with creating text macro you can combine them and create the batch file that will return each file to its original folder as follow
Copy Source_1stLine Destination_1stLine /Y
Copy Source_2ndLine Destination_2ndLine /Y
Copy Source_3rdLine Destination_3rdLine /Y
....
....
....
save the result file as *.bat and execute it.

as i said before this method need many precautions to success like
* the folders structure mustn't changed.
* when you recieve the files it must have the same names as you sent it.
* put the recieved files in the same folder you sent them from.
* make a backup of your folder before executing the batch.

if you can not create a macro for this i can easily make a Visaul Basic program to do this for you and sent it to your e-mail (what is it). i will be happy to listen from you.

there is another easy solution just tell other people about TC. :lol:
Post Reply