Computing.Net > Forums > Windows XP > Batch Rename

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.

Batch Rename

Reply to Message Icon

Name: jfreak53
Date: June 25, 2006 at 13:46:08 Pacific
OS: XP Pro
CPU/Ram: AMD64/512
Product: HP
Comment:

I am looking for a program that will allow me to batch change all the files in a directory to their date stamp, of course replacing / for - and something with the time stamp. I have searched for this and cannot find a program to change their filenames to the files date/time stamp.

Thanks in advance for any help.



Sponsored Link
Ads by Google

Response Number 1
Name: wanderer
Date: June 25, 2006 at 14:10:23 Pacific
Reply:

That sounds more like a script. Might have better luck posting in the scripting and programming forums.

Give a person a fish you feed them for a day.
Ask a person to internet search and they learn a skill for a lifetime.


0

Response Number 2
Name: dtech10
Date: June 25, 2006 at 16:42:27 Pacific
Reply:

Hi jfreak53

This help

@echo off
rem Replace FileNames with Date & Time
if "%1"=="" goto Err
setlocal EnableDelayedExpansion

dir %1 /b /a-d >~Temp1.txt
type nul > ~Temp2.txt
for /f %%a in (~Temp1.txt) do (
set Line=%%~ta
set Line=!Line:/=-!
set Line=!Line::=.!
ren xx\%%a "!Line!"%%~xa
)
del ~Temp?.txt
exit /b
:Err
echo Usage: BatchFile.bat DirectoryName


0

Response Number 3
Name: OVERRIDE
Date: June 25, 2006 at 18:16:06 Pacific
Reply:

you might want to search this link/url

http://www.jpsoft.com/help/index.htm?echo.htm


Override Across the Universe with Fiona Apple


0

Response Number 4
Name: jfreak53
Date: June 26, 2006 at 14:34:59 Pacific
Reply:

I tried the script that dtech10 posted in a batch file, and all it does is give me a Syntax of the Command is Incorrect error during the set fase. It writes nothing to the temp2 file and all it writes to the temp1 file is the filenames, which is fine, but where does it get the dates from. I needed the files to be renamed to their respective date and times, not the current. Any help would be appreciated.

Thanks


0

Response Number 5
Name: dtech10
Date: June 29, 2006 at 15:15:53 Pacific
Reply:

Hi jfreak53
Opps must have been late and not thinking straight or too much beer.
Try This
%%~ta should contain the Date & Time of the file.
put and echo before the line
ren %%a "!Line!" to see whats echoed.

@echo off
rem Replace FileNames with Date & Time
if "%1"=="" goto Err
setlocal EnableDelayedExpansion

for %%a in (%1\*.*) do (
set Line=%%~ta
set Line=!Line:/=-!
set Line=!Line::=.!
if not "%%a"=="%1\!Line!" (
ren %%a "!Line!"
)

)
exit /b
:Err
echo Usage: BatchFile.bat DirectoryName


0

Related Posts

See More



Response Number 6
Name: jfreak53
Date: July 2, 2006 at 17:30:03 Pacific
Reply:

Perfect thanks for all the help.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Can't Install Service pac... Battlefield 2 limited use...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Batch Rename

batch rename www.computing.net/answers/windows-xp/batch-rename/108322.html

In need>batch pic renaming program www.computing.net/answers/windows-xp/in-needbatch-pic-renaming-program/119608.html

Batch Rename Files www.computing.net/answers/windows-xp/batch-rename-files-/109651.html