Using a batch to change the File Date (recursively?)

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
MikeP
Posts: 10
Joined: 16 Apr 2012 11:48

Re: Using a batch to change the File Date (recursively?)

#16 Post by MikeP » 16 Apr 2012 19:28

The very first (2) examples do not appear to be working?
Windows 7 x64 or x32

I just get a blinking cursor (sorry working my way from the bottom up)

-Mike

MikeP
Posts: 10
Joined: 16 Apr 2012 11:48

Re: Using a batch to change the File Date (recursively?)

#17 Post by MikeP » 16 Apr 2012 19:40

I can perform

Code: Select all

copy  *.*  /B  +  ,,  /Y
from inside any folder with success
I was just looking for a way to not have to go folder to folder in command shell
On the ethical side, this may be a grey area, since technically I am supposed to open all 4gb of files, review, and save or delete, but 98% of these files are stored because I want to save them. I just don't edit them often (open, get info, close) this may be a habit I need to change over time.

Either way it is not working :( although I think it is an awesome solution, I have tried it on my personal desktop and I can replicate the problems by using y: instead of h: in the batch file (hangs or dumps everything in root)

Possibly something in Win7?

-Mike

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Using a batch to change the File Date (recursively?)

#18 Post by foxidrive » 17 Apr 2012 00:31

MikeP wrote:I am doing this because I have 4GB of files that are falling into our "new" file scanning software that identifies any file older than 12 months -then automatically schedules the files for deletion unless you open each individual file and save with 30 days.

This is stop gap solution to buy me some time to sort thru the files, without having to open every single one.

Along with this IT has diasbled all USB devices, so I can't just back them up to an external source (for security reasons)

I am playing with both solutions (over VPN) it looks like it might be dumping all of the files from my folders into the root?


I see.

To update the folder creation date, how about you use a batch file to:
A) move an entire folders contents into a temp folder.
B) delete the folder
C) create the folder again
D) move them back
D) do the copy filename+,, thing on the folder.
E) repeat in every folder in the tree

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Using a batch to change the File Date (recursively?)

#19 Post by foxidrive » 17 Apr 2012 00:35

MikeP wrote:I can perform

Code: Select all

copy  *.*  /B  +  ,,  /Y
from inside any folder with success
I was just looking for a way to not have to go folder to folder in command shell



Ooh... this should do it in every folder in the tree.

Code: Select all

@echo off
for /f "delims=" %%a in ('dir /ad /b /s') do (
pushd "%%a"
copy  /B /Y  *.*+,,
popd
)

MikeP
Posts: 10
Joined: 16 Apr 2012 11:48

Re: Using a batch to change the File Date (recursively?)

#20 Post by MikeP » 17 Apr 2012 06:38

Success !

4gb in about 35seconds :)

Thank You Very Much

-Mike

Squashman
Expert
Posts: 4472
Joined: 23 Dec 2011 13:59

Re: Using a batch to change the File Date (recursively?)

#21 Post by Squashman » 17 Apr 2012 06:48

Strange. I wonder why the working directory needed to be set first instead of using the full path in my example.

Post Reply