emptying a folder

Discussion in 'other software & services' started by cet, Jun 9, 2008.

Thread Status:
Not open for further replies.
  1. cet

    cet Registered Member

    Joined:
    Sep 3, 2006
    Posts:
    867
    Location:
    Turkey/İzmir
    I am looking for a way to empty the contents of a folder without deleting that folder.That may be a regedit thing or a shell program.Any ideas?
    Thanks in advance.
     
  2. Bubba

    Bubba Updates Team

    Joined:
    Apr 15, 2002
    Posts:
    11,271
    Hello cet,

    Are you wanting something more advanced(if it exists) than using Windows Explorer and deleting files that are in a particular folder :doubt:
     
  3. cet

    cet Registered Member

    Joined:
    Sep 3, 2006
    Posts:
    867
    Location:
    Turkey/İzmir
    Yes please.I do not want to delete the contents one by one.I want to delete for example only the gif files in that folder.
     
  4. ErikAlbert

    ErikAlbert Registered Member

    Joined:
    Jun 16, 2005
    Posts:
    9,455
    1. Open the folder in Windows Explorer.
    2. Click the first file
    3. Scroll to the last file
    4. Shift-key + click on the last file. All files are selected now.
    5. Right Click in the selected area and choose delete. All files are gone now.
     
    Last edited: Jun 9, 2008
  5. Bubba

    Bubba Updates Team

    Joined:
    Apr 15, 2002
    Posts:
    11,271
    from Windows XP Start button\Help and Support

     
  6. cet

    cet Registered Member

    Joined:
    Sep 3, 2006
    Posts:
    867
    Location:
    Turkey/İzmir
    Thanks Bubba and ErikAlbert.But I am looking for something more complicated.I want to delete all the gif files in a folder or I want to delete the files created in the last week.I am looking for a program, if it exists.
     
  7. Bubba

    Bubba Updates Team

    Joined:
    Apr 15, 2002
    Posts:
    11,271
    I'll still suggest Windows Explorer considering what your describing is not that complicated and is well within the realm of Windows Explorer in regards to sorting, modification dates....etc.

    However, if such a program exists, I'm sure someone will come along with a suggestion.
     
  8. ErikAlbert

    ErikAlbert Registered Member

    Joined:
    Jun 16, 2005
    Posts:
    9,455
    1. Windows Explorer shows certain columns, if you right click in the column area you will see you can add other columns.

    2. If you click on a column the column is sorted in ascending or descending order
    For instance : if you click on "Type" all files are sorted on extension and grouped together.

    3. If you use my previous method, you can easily select and delete a sorted group of files.

    Is that good enough for you or do you really want another program on your computer ?
     
  9. AKAJohnDoe

    AKAJohnDoe Registered Member

    Joined:
    Sep 26, 2007
    Posts:
    989
    Location:
    127.0.0.1
    DELTREE /S followed by a MKDIR may be the most efficient. An alternative is to pipe the Y response into a DEl or ERASE command; however, this would require a FOR loop to manage any subdirectories.
     
  10. MrBrian

    MrBrian Registered Member

    Joined:
    Feb 24, 2008
    Posts:
    6,032
    Location:
    USA
    Xplorer^2 freeware version can do all of this. You can select files by a pattern with this program.
     
  11. NGRhodes

    NGRhodes Registered Member

    Joined:
    Jun 23, 2003
    Posts:
    2,331
    Location:
    West Yorkshire, UK
    You can also use search to find exactly these files, then its a simple case of selecting all the found files and deleting them.
     
  12. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    8,702
    Hello,

    You can use a variety of DOS commands from the command line...

    For instance:

    DEL *.gif

    To zero out files before deleting:

    TYPE nul > fileyouwanttodelete.extension
    DEL fileyouwanttodelete.extension

    You can also try various vbs scripts...

    Also check FORFILES, ROBOCOPY ...

    Mrk
     
  13. cet

    cet Registered Member

    Joined:
    Sep 3, 2006
    Posts:
    867
    Location:
    Turkey/İzmir
    Thank you for all the answers.Now I know that I do not need a program to do what I want.
     
  14. nanana1

    nanana1 Frequent Poster

    Joined:
    Jun 22, 2007
    Posts:
    947
    So many suggestions but none beats my answer here.

    You can create your own bat program to do your desired deletions.
    For example, you want to empty the temp folder of your Windows directory.

    Copy the following into your notepad

    del c:\windows\temp\*.* /q

    and save as deletetemp.bat file.

    Double-click to run the bat program and all files in the Windows temp directory are deleted. Of course, you can also specify to delete only gif files which in that case, the line should read,


    del c:\windows\temp\*.gif /q

    Done !.....Simple as that.*puppy*
     
  15. ErikAlbert

    ErikAlbert Registered Member

    Joined:
    Jun 16, 2005
    Posts:
    9,455
    Isn't that a DOS-solution ? If it is, it's not a solution for average users.
    Besides the OP also wanted to delete files, based on dates.
    I'm sure DOS can handle that too, but you first have to find out how to code it. Why would an average user go through all that trouble, if he can do it with Windows Explorer by using the right columns and sorting possibilities.
    One error in the coding and he might delete more files than he wanted.
     
    Last edited: Jun 11, 2008
Loading...
Thread Status:
Not open for further replies.