Robocopy - copy folders based on creation date - windows

I'm trying to use robocopy to find all folders on a mapped drive and copy them based on the "folder" creation date. If I use /maxage it only looks for "files" age and not the folders, so it copies all folders and then files within the folders matching the /maxage setting.
Is there a /maxage setting for folders instead of files?
Thanks.

Related

Copying 1 file into multiple subfolders

I am a novice. I am trying to copy 1 file into multiple subfolders within windows file explorer. I have successfully copied 1 file into multiple folders within a specified drive using the template below using the CMD prompt.
for /D %a in ("path-to-folder*.*") do xcopy /y /d "Path-to-file\file.FileExt" "%a"
This successfully copies one file to all folders within a specified folder.
Unfortunately I need to copy 1 file into multiple subfolders within a file. I will try to explain as best I can below:
I need an Excel file to copy to all Facility Subfolders within a Facility Folder under Folder1.
File.xls --> Folder 1 --> Facility Folder --> Facility Subfolder
Does that make sense? I need to do this frequently and copy and pasting the excel file to all facility subfolders is time consuming.
Thank you for any assistance!
D

How to duplicate a directory and its subfolders (some empty) using cmd windows 10

I am learning to use cmd and I am starting with simple tasks. I am currently wanting to duplicate a folder and it's subfolders which currently are empty (as I use it as a template folder for future use) but I am stuck and have not found a way to do it.
I have tried copy command
copy "folder name" destination
I have also tried
xcopy /E "folder name" destination
The folder that I want to duplicate is called "TEMPLATE FOLDER" and is located in
"D:\dir1\dir2\dir3\dir4\TEMPLATE FOLDER"
Destination folder is the same as I only want to duplicate the folder so I can rename it afterwards to the new directory I need.
I have previously been able to copy files to other locations but folder or directories seem not to work.
Thanks and I hope you can help
You have tried correctly.
Make sure that the destination folder needs be different name or different folder.
from your example:
copy "folder name" destination
copy sam_data sam_data2
OR
copy sam_data /temp/sam_data2
etc.,
I researched further and found a way to duplicate my folder. Here is how I did it:
xcopy /E "TEMPLATE FOLDER" "TEMPLATE FOLDER2"
So there is no need to add a destination as it will automatically use the directory that I am in. And combined with the /E flag, it copies the empty subfolders (this seems to be a requirement).
Thanks for the help #MagicWorld and #SuperUser

Windows Batch: Copy child folders including files to different location

The structure is like this:
c:\parent\level1\level2\
The level1 folder is empty
the level2 folder contains a lot of folders with files in it.
The goal is to copy all folders in level2 to a different folder, lets say c:\test but by keeping the original name of the folder:
c:\parent\level1\level2\folderwithfiles1\
c:\parent\level1\level2\folderwithfiles2\
The folderwithfiles1 and folderwithfiles2 need to be copied to a different location (including the files that are in those folders).
Now the challenge: the name of the level1, level2 and folderwithfilesX folder is variable (because these are automatically extracted folders).
I hope it's clear like this.
As best as I understand what you are trying to do isn't this just a case of robocopy /mir c:\parent\%l1%\%l2% c:\test which will take all files and subfolders of level2 and below and copy them to c:\test? You may prefer /e rather than /mir depending upon what is in c:\test.

Batch file to create folders and subfolders and copy files into them

I need to copy any pdf files with the word "approved" in the file name from here:
C:\Projects\Project_1\
C:\Projects\Project_2\
To here:
C:\Attachments\Project_1\Documents\
C:\Attachments\Project_2\Documents\
The batch file needs to create the project folder as well as 2 subfolders, "Documents" and "Images" and put the corresponding pdf files in the "Documents" folder.
I created a simple batch file using xcopy but I cannot figure out a way to put the pdfs into a subfolder.
xcopy "C:\Projects\Project_1*approved*" "C:\Attachments\" /s /d /y

.bat file for copy-pasting folder in Windows XP

I need to copy-paste a folder (files + subfolders) into a BackUpfolder. I also need to append the time into the BackUp folder name. xcopy command is letting me copy only files. Your help would be appreciated.
Source Folder = "C:\Documents and Settings.....\Project" (has many files + subfolders)
Target Folder = "C:\Backup-Date/time of backup" Eg Bacup:May 16 2011 12:30 AM
I plan to run this bat file through Scheduler. Thanks!
XCOPY
Copy files and/or directory trees to another folder. XCOPY is similar to the COPY command except that it has additional switches to specify both the source and destination in detail.
XCOPY is particularly useful when copying files from CDROM to a hard drive, as it will automatically remove the read-only attribute.
Syntax
XCOPY source [destination] [options]
/S Copy folders and subfolders
/E Copy folders and subfolders, including Empty folders.
May be used to modify /T.
/H Copy hidden and system files and folders (default=N)
Key
source : Pathname for the file(s) to be copied.
destination : Pathname for the new file(s).
There are several options you can look at :http://ss64.com/nt/xcopy.html
Soruce: http://ss64.com/nt/xcopy.html
I think reading the documentation of xcopy would go a long way.

Resources