Computing.Net > Forums > Windows NT > apend info to the start of a file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to get for your free account now!

apend info to the start of a file

Reply to Message Icon

Name: bellams
Date: December 2, 2008 at 08:11:13 Pacific
OS: NT
CPU/Ram: All
Manufacturer/Model: All
Comment:

I have a directory with a number of files in it. e.g. 1234.pdf 2234.pdf 3234.pdf and so on I want to change the file names on these file using a batch file that i can schedule over night. I want the files to read test-1234.pdf test-2234.pdf test-3234.pdf Can anyone help?


Report Offensive Message For Removal

Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: December 2, 2008 at 13:08:53 Pacific
Reply:

In the batch below replace My_Dir with the path you want

:: MYREN.BAT Usage: myren string
@echo off
if "%*"=="" (echo. no renaming string & goto :EOF)
pushd "My_Dir"
for /F "delims=" %%j in ('dir /B *.pdf') do ren "%%j" "%*-%%j"
popd
:: [End_Of_Batch]

Example: myren test


Report Offensive Follow Up For Removal

Response Number 2
Name: bellams
Date: December 3, 2008 at 01:54:19 Pacific
Reply:

You're a star.
I don't fully understand how this works but it works!

Sean


Report Offensive Follow Up For Removal
Reply to Message Icon

Related Posts

See More







Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: apend info to the start of a file

rename part of a file name www.computing.net/answers/windows-nt/rename-part-of-a-file-name/19508.html

Automatic naming of a PRN file www.computing.net/answers/windows-nt/automatic-naming-of-a-prn-file/880.html

NT Script - verifying ASCII files www.computing.net/answers/windows-nt/nt-script-verifying-ascii-files/20615.html