Delete files from unix




















It is extremely unlikely you'll find a system where rm. EDIT: to do it safe, use rm -rf. See also: find. This won't remove hidden files ones starting with ".

Mandar Shinde Mandar Shinde 2, 10 10 gold badges 35 35 silver badges 53 53 bronze badges. You need to also use the -mindepth switch as others have said.

Maddes Maddes 31 2 2 bronze badges. Eyal Levin Eyal Levin 2 2 silver badges 3 3 bronze badges. So, you have to state the appropriate path explicitly, e. Zaur Nasibov Zaur Nasibov 5 5 bronze badges.

Dharmendra Rajput Dharmendra Rajput 1. This works perfectly for me, tested several variations worked every time. From the directory that holds the images directory.

To delete all files and subdirectories in the current directory, including hidden ones, without error message : rm -rf. Celada This will fail in on filenames that contain whitespace.

I would recommend against using the output of ls as input to other commands, it is generally unsafe. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password.

Post as a guest Name. I've got a problem how to delete files from specific directory. I don't want do it recursively but only in specific directory. Delete files created before specific date. There is a system logging a huge amount of data and we need to delete some of the older logs.

I mean the files that are created before one week from today. Delete lines prior to a specific date in a log file. Hi all. I have a database log file in which log data get appended to it daily.

I want to do a automatic maintainence of this log by going through the log and deleting lines belonging to a certain date. How should i do it? Please help. To delete all lines prior to Jun How do I delete all files that contain specific text? Hi all, I want to remove the files from a folder whcih contain a specific text in it. How to delete specific files only.

Hello, I have these files in my directory. RedHat Commands. OpenSolaris Commands. Linux Commands. SunOS Commands. FreeBSD Commands. Full Man Repository. If you're confident in what you're deleting, and you VERIFY that the directory provided isn't a system directory, you can streamline the command without a prompt. I'd recommend saving the output for review. You can then do a line count on the output file.

Join Date: Mar But there is one more concern. This command deletes all the files in the specified directory along with files in sub-directories also. The requirement is like, it should delete files that are 5 Days old only in the directory specified and not the subdirectories within it. Any idea on how to do that? Thanks in advance.

Join Date: Apr Adding -maxdepth 1 would do the trick, this way the find command only searches 1 level deep in the directory structure. Last edited by ruleant; at AM..

Reason: reaction to later post. Shell script to delete the ip address from files. Hello, I am new to shell scripting, need help, my requirement is to delete the ip address from serveral files, please suggest 2 Replies.

Shell Script to delete files from 5 different servers. Hello, I'm new to shell scripting and need a quick note on how to write a shell script to perform deletion of files from 5 different hostnames in various locations.

Found out to delete files from one path by using below command and made it to work on cron job but need to do it in a shell Shell script to check a file and delete old files. Hello, I needed help with a shell script where in it checks if a file exists under a directory and also checks the age of the file and delete it if it is older than 3 weeks.

Shell Script to delete the protected files. Hello, we have more than files in a directory which are write-protected regular file, these files are quite old and would like to delete them completely, Kindly let me know the command or peice of code to automate the process. Unix shell script to delete files on windows server.

Hi experts, can anyone suggest me on the below: how to write a shell script to search and delete files on windows server. I have a local linux machine in which the files are dumped by a remote ubuntu server.



0コメント

  • 1000 / 1000