Windows script to delete folder - windows

I need to have windows script to delete folder & files those are older by x days than the last modified folder, So if there are only the folders modified by same date then no folder should be deleted, else if there is any folder older by x days than last modified folder date needs to be deleted.
Could someone please response on it?

Related

I want to copy file from one folder to another using cmd, with each file copied is updated with newer date

I want to copy from one folder to another on daily basis but each file copied is updated with current date.
I know the code to copy file but I dont know how to copy file with updated date and I need to put this in Task scheduler to run it daily.
This is my code:
cd C:\Automation\
Copy "Z:\VENDOR_LOAD\Access DB\COMPLETE SM DATA\SupplierMaster_Query.xlsx" "Z:\VENDOR_LOAD\Access DB\COMPLETE SM DATA\BACKUP\SupplierMaster_Query_.xlsx"

Can I delete /Library/Developer/CommandLineTools/SDKs?

I have a problem. Inside this directory, /Library/Developer/CommandLineTools/SDKs I have 5 folders (MacOSX.sdk, MacOSX10.15.sdk, MacOSX11.1.sdk, MacOSX11.3.sdk, MacOSX11.sdk)
Now I need to program on the command line from terminal, (using gcc), is it a problem if I delete these folders since they are contained within the CommandLineTool folder?
Attention, i don't want to delete the whole directory, only the 5 folders

Delete most recently added directory to a directory in applescript

I'm making a script to delete messages history on a my mac. I need it to delete the most recently added folder to a directory. I can delete a folder that I have the name of, but I have no idea how to get the most recently added folder to delete it. The archive folder is ~/Library/Containers/com.apple.iChat/Data/Library/Messages/Archive.
Thanks
Sort the folders in Finder by creation date and get the last item
set archivedMessages to (path to library folder from user domain as text) & "Containers:com.apple.iChat:Data:Library:Messages:Archive:"
tell application "Finder"
set mostRecentChat to last item of (sort folders of folder archivedMessages by creation date)
delete mostRecentChat
end

Trying To Move Folders Based On Name and Date With a Bash Script

I have an archive of folders with subfolders labeled, 2012-08-29, 2012-10-10, 2012-09-01 etc., that I'm trying to archive with a bash script into folders monthly 2012-08, 2012-09, 2012-10, etc.
I was initially archiving by week but found that it would be problematic when a week would have days from 2 different months as 1 or more of the days would be archived in the wrong month's folder.
Any idea on trying to make this happen with a simple bash script?
Basically you move the daily folders from a month 2012-08-* to the month folder 2012-08:
mv 2012-08-* 2012-08
Pretty simple, isn't it?

Mirroring folder on the same file server reduces the modified date by 1 hour

I am facing this weird issue in which when I mirror a folder on same file Server then in the destination folder for all the sub folders modified date is one hour earlier to what was there in source folder for the same folder.
Say my folder1 has a sub folder folder1_sub1 whose modified date is 2/28/2011 3:54 AM.
Then in destination folder say folder2 for sub folder folder1_sub1 modified date is 2/28/2011 2:54 AM.
The same happens for files.
My best guess is that it could have happened due to Day Light Savings time, but am not sure, as the time on fileShare server(server1-fs01.services.local) and server where I run the batch file have the same time.
This is my content of the batch file which I use to mirror files
set args=/mir /dcopy:t /log+:"C:\log.txt" /tee
robocopy "\\server1-fs01.services.local\AppData\Folder1" "\\server1-fs01.services.local\AppData\Folder2" %args%
Let me know if you any more queries.
My recommendation: use option /DST to Compensate for one-hour DST time differences. http://technet.microsoft.com/en-us/library/cc733145(WS.10).aspx
PS: the newer version on robocopy doesn't run on XP or on Windows Server 2003.

Resources