Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to upload everything in a folder besides a .avi file and i was wondering what i would put at the end of the path for it to ignore all avi files.

I know that putting "/*avi" will make it upload only the avi, but i'm trying to make it upload everything besides the avi.

So can someone give me some pointers as i'm still fairly new the ubuntu world.

Here is the command i'm using

python poster.py -f "[test]" -c sample.conf -g alt.binaries.test /killer/Desktop/Downloads/the\folder\i\wanna\upload/*

I'm just trying to figure what i'd have to do to upload that whole folder, but not upload the avi files inside it. I would just move the avi files out, but i plan on doing stuff like this a lot so i don't wanna have to keep moving the files and would rather just know how to exclude them.

share|improve this question
    
Does no one know a simple solution to this? –  kkiller23 Mar 11 '12 at 14:37
    
Upload to where? Using which tool? –  krlmlr Mar 11 '12 at 15:16
    
Using newsmangler github.com/madcowfred/newsmangler –  kkiller23 Mar 11 '12 at 15:37
    
Please update your question to make it reflect that you you want to upload with a particular tool. –  João Pinto Mar 11 '12 at 16:10
add comment

2 Answers 2

Using bash, you can use the pattern

/path/to/files/!(*.avi)

to represent all files other than AVI files.

share|improve this answer
    
I really thought this was going to work, but it tells me that "event not found" –  kkiller23 Mar 11 '12 at 17:03
    
You have shell history turned on, so you should escape your esclamation mark: /path/to/files/\!(*.avi) ` –  enzotib Mar 11 '12 at 19:26
    
It requires that the extglob shell option has been enabled. Put the line shopt -s extglob at the start of the script where you need it, and put it in ~/.bashrc to have it enabled in interactive sessions. –  geirha Mar 11 '12 at 22:28
add comment

I have to admit I did not know the answer to this, but after a little digging up I found a good answer for you:

rsync /source/folder -av --exclude='*.avi' /destination/folder

You can add as many excludes as you like: --exclude='.avi' --exclude='.mkv' --exclude='*.mp3' ect..

The -v option is for verbose, so that you see in the output what's being synced.

share|improve this answer
    
So, would just adding --exclude='*.avi' to the end of each python command make it ignore the avi files? –  kkiller23 Mar 11 '12 at 15:39
    
I don't know python and exactly what you want to upload. I offered you a solution to sync 2 directories excluding certain file types –  bioShark Mar 11 '12 at 15:53
    
No, "--exclude" is not a generic python parameter, it's a parameter for the "rsync" utility. –  João Pinto Mar 11 '12 at 16:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.