
- Mac command line delete directory with files pdf#
- Mac command line delete directory with files windows#
I use the unlink term since this is the underlying system call associated with a shell's rm command. The MacOS also has a secure remove command (srm) which over-writes a file before it is unlinked making it unrecoverable. You can also do the same with PowerShell if you prefer with the cmdlet Get-ChildItem and Where-Object. The central issue is that nothing else re-uses any of the disk blocks represented by your file. ForFiles /p "z:\OneDrive" /s /m *.PDF /d -365 /c "cmd /c del you need to do this frequently or on different computers, you can put it in a batch file so you can run it by double-clicking it. To delete the files found in the search, replace “ echo” with “ del” in the command.

/c to indicate the command to execute each file found in the search./d to select files with a last modified date.
Mac command line delete directory with files pdf#
In this case, use *.PDF to find all PDF files. /m to define the search mask for the specified files./s to search all subfolders recursively./p to indicate the path to start the search.ForFiles /p "z:\OneDrive" /s /m *.PDF /d -365 /c "cmd /c echo which,

Mac command line delete directory with files windows#
Yes, of course, you can still do so from the powerful File Explorer that comes with Windows but it certainly takes more steps than a simple command.įor example, if I need to search for a list of PDF files that are older than a year in my OneDrive, I can open Command Prompt and run the following command.

Perhaps, the easiest way to delete files at a certain age is through a command line or a batched file or even a script.
