If you want to print all the subdirectories in the current directory forfiles /m * /c "cmd /c if echo there a way that i can delete the files with enable flag = y and xdays older using batch script and i need is folder path, file pattern, retention period and flag.? Read this: Rename File extensions in bulk List all sub-directories in a given folder Rename file extensions using forfiles command Get list of all exe’s and their last modified date forfiles /M *.exe /C "cmd /c echo c:\Windows>forfiles /M *.exe /C "cmd /c echo To search picture of different file type(jpeg, png etc), the command has to be triggered again. Similarly we can use below variables in the command – Name of the file(includes – Name of the file excluding – Relative path of the file from current – Extension of the – Size of the – Last modified date of the – Last modified time of the file delete all log files created in the last 1 month forfiles /D 30 /S /M *.log /C "cmd /c del Copy/Backup files modified after 1st Jauary 2015 forfiles /D /M * /C "cmd /c copy D:\backupFolder\" Get list of all picture files with their size forfiles /S /M *.jpg /C "cmd /c echo command searches pictures of only jpg type. Find all excel files modified 10 days back in the current folder and subfolders forfiles /D -10 /S /M *.xlsx /C "cmd /c echo the above command is used to print the complete absolute path of the file. We can use any combination of the above to select the required files. Look for files in a specific directory (option /P) Look for files in subdirectories also (option /S) Modified date or Number of days it was last modified from (option /D)
0 Comments
Leave a Reply. |