Here are some interesting Operating system and softwares tips and tricks 4u.JUST CLICK ON THE PICTURE IN THE BLOG FOR ENALARGED VIEW.

sd

Sunday, February 5, 2012

Not deleting necessary files in spite of their old date of creation(Windows Vista, 7)

By Sunday, February 05, 2012 , No comments
               Certain data and temporary fi les must be deleted automatically by Windows based on their date of creation. Although the search function off ers special options, you must execute the search and delete processes manually.
             You can allow this task to be performed by a script. In such a case, use the ‘for files.exe’ prompt program, which allows editing of files based on their date of creation.
              To begin with, open a prompt by typing ‘cmd’ in the search fi eld of the start menu, and press the [Enter]. Using ‘forfiles /?’, you can receive help with the tool. As other options, you can integrate the search path with the ‘-p’ parameter, the date fi lter with ‘-d’ as well as a search sample with ‘-m’. The ‘-s’ parameter ascertains whether the search should include all subfolders. Without the path entry, the current folder is selected as default.
             You can use the date filter either by directly entering the date in the form of ‘DD.MM.YYYY’, whereby a preset plus character selects the new files and a minus character selects all files before the specified date. As an alternative, you can set the date entry in form of ‘-DD’ for the selection of files, which are older than the specified number of days. For example, to search all Excel files in the ‘E:\Date’ folder, which were changed after 23.04.2010, the following command is used:
forfiles p E:\Date m *.xls -d +23.4.2010 
With the help of the
forfiles p C:\Temp -s -m *.jpg -d -10 
command, Windows deletes all JPG fi les in the temporary folder, which are older than ten days. Subsequently, you can allocate yet another command to the forfi les command with the ‘-c’ parameter, which shall be applied for the fi les in the search results, for instance
-c cmd /c echo @FILE 
Thereby, the command in the prompt enlists all searched fi les. For more output variables, you can even use the ‘@EXT’, ‘@PATH’ or ‘@FSIZE’ parameters. These display the extension, the complete path name and the fi le size respectively. A command for deleting older files from the ‘E:\Date’ folder can, for instance, be as follows:
forfiles p E:\Date -m *jpg -s |d -14 -c cmd /c del @FILE
Your commands with the necessary parameters can be copied in a text fi le and can, for instance, be saved on the desktop as a batch file with the name ‘Kill_old.bat’. This way, you will have complete access to it.
ATTENTION: First of all, test the command by replacing ‘del’ with ‘echo’ and thereby check the output of the script without actually running it. Otherwise, you could unknowingly delete too many files, especially in case of recursive processing.

0 comments:

Post a Comment

please write your comment

Note: Only a member of this blog may post a comment.

THE WINDOWS TRICKS Headline Animator