Warning: This functions described here will delete a directory tree without questions ask and faster then you can press Ctrl-C to abort. So use with care.
For a while now I have used the following function to delete directory trees:
Today I finally found the time to create a similar function for TakeCommand which I like to share with you all:
Originaly I wanted to create an alias as this is closer to the original idea of a shell function. But I could not get the FOR loop to work.
Note that I did not use /K or /R for the ERASE command. You might want to consider the advantages and disadvantages of those options.
For a while now I have used the following function to delete directory trees:
Code:
function deltree () {
for I in "${=@}"; do
mv --verbose "${I}" "${I}.delete"
rm --recursive --force "${I}.delete" &
done; unset I
return
}
Today I finally found the time to create a similar function for TakeCommand which I like to share with you all:
Code:
@ECHO OFF
SETLOCAL
DO I IN "%$"
RENAME %I %I.DELETE
DETACH ERASE /E /S /X /Y /Z %I.DELETE
ENDDO
ENDLOCAL
Originaly I wanted to create an alias as this is closer to the original idea of a shell function. But I could not get the FOR loop to work.
Note that I did not use /K or /R for the ERASE command. You might want to consider the advantages and disadvantages of those options.