Removing a range of files in a directory..


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Removing a range of files in a directory..
# 1  
Old 05-24-2012
Removing a range of files in a directory..

Hi all,

Disclosure: I am very new to Unix, but eager to learn..

I've been tasked with transferring logs to a remote server. After I've verified these logs have transferred correctly I have to remove the source files. The naming scheme is:

/directory/2012.05.01
/directory/2012.05.02
..and so on for multiple years.

I tried:
find /directory/name -type f -iname "2012.04.[04-30]" -exec rm -f {} \;
Please go easy on me Smilie like I said I'm very new and work by myself on graveyard. So other than google have little to no one to turn to. Any pointers are greatly appreciated..

Thanks,
-J
# 2  
Old 05-25-2012
Please post what Operating System and version you are running and what Shell you use.

Is the log file transfer and verification scripted? If so, then that script would be the best place to remove the source file?

I suspect that nobody has responded to this thread because there the context and criteria are too vague.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Removing letters after a certain character within a range of columns

Hi there, I am trying to remove al letters after : character on specific columns from 10th column till 827. I used sed and cut to do so but I am sure there is better one liner someone can think of from unix community members. Huge file but it has this structure (Total number of Columns =... (10 Replies)
Discussion started by: daashti
10 Replies

2. UNIX for Dummies Questions & Answers

Help with removing files with date range

Hi, I want to remove trace files in a particular directory for a specific date range. Currently i can remove based on time (e.g find /path/*.trm -mtime +1000 -exec rm {} \;). But i want to remove .trm files within a date range. E.g to remove .trm files between jan 1 2002 to April 15 2005. ... (3 Replies)
Discussion started by: dollypee
3 Replies

3. Emergency UNIX and Linux Support

How to move files from a directory which falls between Date Range?

Hi All, I am trying to to move files from a directory to another which falls from Current day - 7 days. The files are in zipped format with dates appended on it. Can you pls help me as this came as a immediate change before the production Release planned next week. Pls let me know if... (11 Replies)
Discussion started by: dsfreddie
11 Replies

4. Shell Programming and Scripting

removing a range of characters in a filename

hi, I have quite a bunch of files with annoyingly long filenames. I wanted to cut the range of characters from 9-18 and just retain the first 8 characters and the .extension. any suggestion how to do it. thanks much. original filename: 20000105_20000105_20100503.nc.asc output filename:... (4 Replies)
Discussion started by: ida1215
4 Replies

5. Shell Programming and Scripting

help with removing files from home directory

hey there folks! I cant figure out, for the life of me, how to procede in removing alll the files in my home directory that are not owned by me. would i have to list them, but after that what do i do. or is there some way I am not aware of. my employer heard i could script in unix, but i havent... (3 Replies)
Discussion started by: Ginkosu
3 Replies

6. Shell Programming and Scripting

Need script to select multiple files from archive directory based on the date range

hi all, here is the description to my problem. input parameters: $date1 & $date2 based on the range i need to select the archived files from the archived directory and moved them in to working directory. can u please help me in writing the code to select the multiple files based on the... (3 Replies)
Discussion started by: bbc17484
3 Replies

7. Shell Programming and Scripting

Removing files older than one week in a directory

Hi, I need a shell script to remove the files older than a week in a directoy and if necessary to zip the files. (2 Replies)
Discussion started by: sudhakaryadav
2 Replies

8. UNIX for Dummies Questions & Answers

removing the files but not the directory

How would i rmeove all the files in the directory but still keep the directory? (5 Replies)
Discussion started by: JamieMurry
5 Replies

9. Shell Programming and Scripting

removing old files from client directory: awk

I would help with removing old files from client directory and put the new files in there............. Below code gives me wrong outout, it's supposed to delete old files from client directory ............................ am I missing anything ? {removing *** Hash Passive mode: off;... (2 Replies)
Discussion started by: sambakamba
2 Replies

10. Shell Programming and Scripting

Removing files automatically from a directory after 30 days.

Hello; I have a directory that is collecting log and act files. I need to write a script that will remove these files once they are 30 days old. I have read through a number of threads on this site that have given me a great deal of information. However I have what seems to be a unique... (7 Replies)
Discussion started by: justinb_155
7 Replies
Login or Register to Ask a Question