Results 1 to 7 of 7

Thread: How to delete files that appear in find command's output in Linux

  1. #1
    Join Date
    Mar 2011
    Posts
    83

    How to delete files that appear in find command's output in Linux

    Hello friend, I want to delete all the files that come out in the find command's output screen. I try to use the different command but I can’t succeed to do this. Basically I want to remove this all files which has not edited in the last 8 days. This files present in /bla/ directory. I am the new person in the Linux operating system and I checked some command but I didn’t found the correct solutions. If anyone have idea about this command then please share it. I will be appreciates that knowledge.

  2. #2
    Join Date
    Nov 2009
    Posts
    1,416

    Re: How to delete files that appear in find command's output in Linux

    There is some possibility to do this task. The Linux have to be based on the UNIX operating system. The shell prompt of this Linux OS is specially designed for performing this kind of operations Specially, executing the different command on the system. The proper command present in the Linux to perform these operations. This can be done in just one line executions. First put the find command as per the requirement. Then immediately put the –exec command and then enter the rm command to remove the find output file. This solved the trouble.

  3. #3
    Join Date
    Nov 2009
    Posts
    1,035

    Re: How to delete files that appear in find command's output in Linux

    I also faced the same kind of trouble in the fedora OS and that time I have never idea about how to do it. Then I read the fedora user guide manual. In that one special command is mentioned. This is the xargs command. This command is useful for the build and executes standard input of the command lines. It means after using the one command and the pipe operations this previous command output can be given to the next command. Then I use the find /bla/* -mtime +8 | xargs rm * code to perform the task. It works the operations has to be done on the system.

  4. #4
    Join Date
    May 2008
    Posts
    859

    Re: How to delete files that appear in find command's output in Linux

    I think you need to check the rm command of the Linux. The descriptions of the rm command should be providing some kind of guidance to perform these unknown operations. Then you need to just put the rm --help command on the shell prompt. Then it gives the basic information about the rm command. If any possibility related to these topics then it shows the kinds of option to perform these operations. Then I suggest you to do this task and it helps you to solve the trouble.

  5. #5
    Join Date
    May 2008
    Posts
    1,020

    Re: How to delete files that appear in find command's output in Linux

    Try to execute the pipe command in the shell prompt. The pipe command is designed for executing the multiple commands in the single line. The output of the first command is provided as an input to the next command. Then the final command output it put on the screen. Then I just suggest you to try these solutions. It might be possible that you could build the code. This is the normal solutions and the Linux user can understand its result.

  6. #6
    Join Date
    May 2008
    Posts
    962

    Re: How to delete files that appear in find command's output in Linux

    Hey, the solutions you mentioned for use the rm command and then use the pipe command to perform this task is not work in the Linux OS. The reason behind this is the rm command has some restrictions. In that the rm commands can’t take the standard input of the command line. It directly removes the parameter or the file name provided by it. You can check this by using the rm –help command. This gives you the full descriptions of the rm command.

  7. #7
    Join Date
    Apr 2009
    Posts
    994

    Re: How to delete files that appear in find command's output in Linux

    Hi. I also faced the same trouble and I want some kind of solutions which helps to execute this both find and the rm command on the single line. I use the pipe command to do this but it can’t work. Then I read some articles and there are so many codes present in that article. But most of the code can’t work. Then I try this code one by one and finally I got the correct code. I think if you have not got the correct solutions then need to search more. This helps you to execute this both command in single line.

Similar Threads

  1. How to find & delete duplicate files in Apple Mac OSX
    By Acardi !! in forum Windows Software
    Replies: 10
    Last Post: 30-04-2013, 03:02 PM
  2. Replies: 3
    Last Post: 06-06-2011, 11:13 AM
  3. Bash command to delete entire Files from folder
    By Strangers in forum Windows Software
    Replies: 4
    Last Post: 11-11-2010, 09:30 PM
  4. Download files from Linux command line
    By chaosblade in forum Operating Systems
    Replies: 3
    Last Post: 28-08-2009, 03:18 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,170,914.13147 seconds with 17 queries