Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Script to Remove old folders/files

$
0
0

Hi,

I am looking to delete files which are older than 14 days on a particular share, i see that there are already various other versions of the script present but they do not seem to work since the share contains folder exceeding the 256 character limit for windows. I tried the same through Robocopy which seems to ignore the character limit but it removes the files from folders which are not 14 days old.

What i would rather prefer is that it skips all folders which are less than 14 days old and remove folders/files which are older. Please suggest if this can be edited in any way or some other script which ignores 256 character limit and does the job.

:: "Removing 14 days old data"
:: *******************************
SET _source=\\server\share
SET _dest=\\server\shareToDelete
SET _what= /S /E /Move:D /MINAGE:14
SET _options=/LOG+:BackupHistory.log /NS /NP /FP /NDL /xf "filename" /r:1 /w:0
:: /LOG+:file : Output status to LOG file (append to existing log).
:: /NS : No Size - don’t log file sizes
:: /NDL : No dir logging
:: /FP : Include Full Pathname of files in the output.
:: /NP : No Progress - don’t display % copied.
ROBOCOPY %_source% %_dest% %_what% %_options%
RMDIR %_dest% /q /s 
Thanks In advance


Viewing all articles
Browse latest Browse all 15028

Trending Articles