Directory Clean-up
Clean up a directory by moving or copying files into a subdirectory based on the files creation date. Can be used to move results from script that generates output files.
[] = DirCleanUp(in,flag_copy,newdir,dirname,readmefile);
in = [30;10] -> move/copy all the files from -30 days to -10 days form now into a new directory
in = 30; -> move/copy all the files from -30 days to now into a new directory
"in" can be in datevec format [2003 10 13 17 43 00] for [year month day hour min sec]
flag_copy -> if 1 copy, else move the files, default is move
newdir -> new directory name, default is "test_currentdate"
dirname -> the directory to be cleaned up, if not given ask for directory
readmefile -> file to be copied in the new directory as "readme.txt"
examples:
DirCleanUp(24,1,'Toto','C:\temp');
copy all the files of the last 24 hours from c:\temp into C:\temp\Toto
DirCleanUp([2000 01 01 00 00 00;2000 12 31 23 59 59],[],[],[],'toto.txt');
move all the files from january 1st 2000 to december 31st 2000 into the subdirectory test_23-Nov-2004_11-29-45 of the directory selected by the user (using uigetdir), and copy the file toto.txt in the new directory to readme.txt
Cite As
Olivier Salvado (2024). Directory Clean-up (https://www.mathworks.com/matlabcentral/fileexchange/6372-directory-clean-up), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |