find and compress question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find and compress question
# 1  
Old 01-20-2012
find and compress question

I am trying to accomplish follow

1- search $dir_find for \*.txt\*
2- exclude 2 directories $dir_find/abc/* and $dir_find/fit*
3- compress find result
4- move all compressed file to different directory

Here is what I have tried. How/where can I add mv?? Can I add to same line/command?
Code:
compress `$dir_find -name \*.txt\*|egrep -v "abc|fit*"`

Thanks in advance.

Moderator's Comments:
Mod Comment Use code tags, thanks. See PM.

Last edited by zaxxon; 01-20-2012 at 07:42 PM.. Reason: code tags
# 2  
Old 01-20-2012
There is much variation in the "find" command and compression utilities. For the benefit of people reading this post please post what Operating System and version you have and what Shell you are using.


Quote:
2- exclude 2 directories $dir_find/abc/* and $dir_find/fit*
Please clarify. Does the expansion of * in both of these conditions produce the name of a directory or does * refer to files within the parent directory?
A representative example always helps.

What's the name of the directory to contain the final files?
Is it safe to assume that all filenames in the $dir_find tree are unique?

Btw. Your initial code does not contain the command "find".
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Question on ls and find

Hi, Is there an option to run ls to only show files owned by the current user? Currently doing ls | awk | grep for the user. If I use find and -user ${username}, I am getting Permission denied messages on some directories and am currently re-directing those messages as 2>/dev/null. Is that... (2 Replies)
Discussion started by: newbie_01
2 Replies

2. Shell Programming and Scripting

'find' question

hey guys! I need to find in a specific directory and its sub-directories a file thats passed has a argument, and print it has like a ls -l command! the problem is how do i print has a ls command but instead only the file name in the end, also the directory where its insered! ex: Want... (2 Replies)
Discussion started by: Shinni
2 Replies

3. UNIX for Dummies Questions & Answers

Issue: Compress in unix server and FTP to windows and open the compress file using Winzip

Hi All ! We have to compress a big data file in unix server and transfer it to windows and uncompress it using winzip in windows. I have used the utility ZIP like the below. zip -e <newfilename> df2_test_extract.dat but when I compress files greater than 4 gb using zip utility, it... (4 Replies)
Discussion started by: sakthifire
4 Replies

4. UNIX for Dummies Questions & Answers

find new files and compress them

Hi! First off I'd like to stress that I'm a true dummy :) I have a website with SSH access and since it has user generated content I want to backup my website every day end send it through FTP to a different server. I got it working for my mysql database, so the only thing remaining are the... (2 Replies)
Discussion started by: Mark Wegener
2 Replies

5. Shell Programming and Scripting

find . -name question

Not sure if I'm missing it, but I'm looking on the find man page, but can't find it. Here is what I'm doing find . -name "log_*" -type f -mtime +8 -exec rm {} \; How do I tell man to find all files matching that pattern, but only ones that end with a numeric character. I thought it was... (4 Replies)
Discussion started by: cbo0485
4 Replies

6. UNIX for Dummies Questions & Answers

Compress.exe Question

I have noticed while Compressing certain .tar files using Compress.exe, sometimes the Compressed version is bigger than the original which causes the Compressed version to be deleted. Is this normal behavior? (5 Replies)
Discussion started by: brown
5 Replies

7. UNIX for Dummies Questions & Answers

Question about 'find'

I have a file, but I don't know this file is stored in which directory, if I use 'find' command to search this file, is it work? which option I use? find filename? (2 Replies)
Discussion started by: wendyz
2 Replies

8. Shell Programming and Scripting

compress file using find

im doing a script to compress files in ${CompressPath} withe files older than ${FileAge}. The line below actually works, but I only need to compress files that are in ${CompressPath}. This line compresses all files that it can find under the ${CompressPath} and all its sub dirs. is there a way to... (6 Replies)
Discussion started by: tads98
6 Replies

9. UNIX for Dummies Questions & Answers

find ...question.

:D i am looking through the man pages of the find command and I have found the -printf and fprintf section.. . I tried this command and got an error find -follow -newer 'date.file' -printf %f file1 i keep getting a %f in directory listing and no input into file1 according to the manpages %f... (2 Replies)
Discussion started by: moxxx68
2 Replies

10. UNIX for Dummies Questions & Answers

find question

Is it possible for find to match on multiple arg's. Basically, I would like to be able to match on name and atime. Basically I want something like: find . -atime +31 <AND> -name *.log -exec rm -f {} \; Thanks (2 Replies)
Discussion started by: 98_1LE
2 Replies
Login or Register to Ask a Question