Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Copy + Rename in DOS
Name: gav Date: September 8, 2004 at 03:07:29 Pacific OS: WIn 2000 CPU/Ram: P4
Comment:
I'm not sure how much of this is possible in DOS but any help would be appreciated.
I have a folder with several thousand files all named aaaa_bbbbbb#bbbbbb_yyyymmddhhmmss.sum, where aaaa is a 4 digit number and bbbbbb is a 6 digit number and the last bit is a date/time stamp.
What I'm trying to do is copy all the files with a certain value for 'bbbbbb' (there will be multiple files that match this) to another folder and remove the 'aaaa_' from the start of the name.
Its been years since I've even looked at DOS so I have no idea where to begin. Any help would be great.
Name: IVO Date: September 8, 2004 at 03:37:19 Pacific
Reply:
Just set up the following two lines batch, name it MyCopy.bat and type MyCopy From_Folder To_Folder Number (e.g. MyCopy C:\MyDir C:\NewDir\SubDir 567980), blanks not allowed in folder's name.
@Echo Off
For /F "tokens=1,* delims=_" %%A in ('Dir /B %~f1\????_%3*.sum') Do ( Copy %~f1\%%A_%%B %~f2\%%B)
By the way that is NT-kernelk scripting as there is no DOS at all in Win 2K/XP, only an emulator.
If anything goes wrong or you need more support, post again.
0
Response Number 2
Name: gav Date: September 8, 2004 at 04:05:56 Pacific
Summary: I have multiple files and need them merged into one file. File_February_1.txt File_February_2.txt File_February_3.txt File_February_4.txt I do a "copy File*.txt FileList.txt" I'd like to have my outp...
Summary: Hello, I would like to create a batch file that will copy and rename files from a directory on my c:\ drive into another folder. For example, the current file is in C:\DATA\CLCDATA\BP.txt I would lik...
Summary: I'm trying to read single lines from a text file and store each line in a variable so that I can use that variable to do something (such as COPY, RENAME, MOVE, etc). Here is the operation I want: 1) R...