Sponsored Content
Top Forums Shell Programming and Scripting Wget - how to ignore files in immediate directory? Post 302906014 by vanessafan99 on Monday 16th of June 2014 04:16:42 PM
Old 06-16-2014
Wget - how to ignore files in immediate directory?

i am trying to recursively save a remote FTP server but exclude the files immediately under a directory directory1

Code:
wget -r -N ftp://user:pass@hostname/directory1

I want to keep these which may have more files under them
Code:
directory1/dir1/file.jpg
directory1/dir2/file.jpg
directory1/dir3/file.jpg

but I want to exclude all the files directory under directory1, as these are the unsorted files

Code:
directory1/file1.jpg
directory1/file2.jpg


How can I exclude all the files immediately under directory1 but keep all other files?

thanks!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to ignore '.' files

I'm running Fedora Core 6 as an FTP server on a powerMac G4... I'm trying to create a script to remove files older than 3 days... I'm able to find all data older than 3 days but it finds hidden files such as /home/ftp/goossens/.canna /home/ftp/goossens/.kde... (4 Replies)
Discussion started by: James_UK
4 Replies

2. Solaris

How to ignore incomplete files

On Solaris, suppose there is a directory 'dir'. Log files of size approx 1MB are continuously being deposited here by scp command. I have a script that scans this dir every 5 mins and moves away the log files that have been deposited so far. How do I design my script so that I pick up *only*... (6 Replies)
Discussion started by: sentak
6 Replies

3. UNIX for Advanced & Expert Users

Why is wget copying my directory tree with some files with "@"?

I'm using wget 1.11.4 on Cygwin 1.5.25. I'm trying to recursively download a directory tree, which is the root of a javadoc tree. This is approximately the command line I tried: wget -x -p -r http://<host>/.../apidoc When it finished, it seemed like it downloaded... (0 Replies)
Discussion started by: dkarr
0 Replies

4. Shell Programming and Scripting

wget a directory structure question

Can you tell me how to download the directory tree just starting from "project1/" in this URL? "https://somesite.com/projects/t/project1/" This command does not seem to do what I want as it downloads also files from the upper hierarchy: wget --no-check-certificate --http-user=user... (4 Replies)
Discussion started by: majormark
4 Replies

5. Shell Programming and Scripting

Getting ls to ignore ~ and # files

Is there a way to customize ls to ignore files ending with ~ and #? (those are Emacs backup and auto-save files). I found -B option, which only ignores ~ files (2 Replies)
Discussion started by: yaroslavvb
2 Replies

6. Shell Programming and Scripting

Find: ignore directory completely

Hello, I know find can be prevented from recursing into directories with something like the following... find . -name .svn -prune -a type d But how can I completely prevent directories of a certain name (.svn) from being displayed at all, the top level and the children? I really... (2 Replies)
Discussion started by: nwb123
2 Replies

7. Shell Programming and Scripting

Wget to ignore an IP address

Hello Unix Geeks, I am in a situation to use wget for crawling a site where the site contains 5 IP addresses. Out of 5, 4 are accessible and 1 is having a problem due to firewall problems. In this case, my wget is getting stuck with that X.X.X.X and giving up. How can I ignore this IP and... (4 Replies)
Discussion started by: sathyaonnuix
4 Replies

8. Shell Programming and Scripting

Find command with ignore directory

Dear All, I am using find command find /my_rep/*/RKYPROOF/*/*/WDM/HOME_INT/PWD_DATA -name rk*myguidelines*.pdf -print The problem i am facing here is find /my_rep/*/ the directory after my_rep could be mice001, mice002 and mice001_PO, mice002_PO i want to ignore mice***_PO directory... (3 Replies)
Discussion started by: yadavricky
3 Replies

9. Shell Programming and Scripting

How to change wget download directory?

i have a cron that mirrors a site periodically wget -r -nc --passive-ftp ftp://user:pass@123.456.789.0 i want to download this into a directory called /files but when I do this, it always create a new directory called "123.456.789.0" (the hostname) it puts it into /files/123.456.789.0 but... (3 Replies)
Discussion started by: vanessafan99
3 Replies

10. UNIX for Advanced & Expert Users

AIX find ignore directory

I am using aix. I would like to ignore the /u directory. I tried this but it is not working. find / -type f -type d \( -path /u \) -prune -o -name '*rpm*' 2>/dev/null /u/appx/ls.rpm /u/arch/vim.rpm (4 Replies)
Discussion started by: cokedude
4 Replies
File::NCopy(3pm)					User Contributed Perl Documentation					  File::NCopy(3pm)

NAME
File::NCopy - Deprecated module. Use File::Copy::Recursive instead. Copy file, file. Copy file[s] | dir[s], dir SYNOPSIS
use File::NCopy qw(copy); copy "file","other_file"; copy "file1","file2","file3","directory"; # we want to copy the directory recursively copy 1,"directory1","directory2"; copy 1,"file1","file2","directory1","file3","directory2","file4", "directory"; # can also use references to file handles, this is for backward # compatibility with File::Copy copy *FILE1,*FILE2; copy *FILE1,"file"; copy "file1",*FILE2; # we don't specify 1 as the first argument because we don't want to # copy directories recursively copy "*.c","*.pl","programs"; copy "*", "backup"; use File::NCopy; # the below are the default config values $file = File::NCopy->new( 'recursive' => 0, 'preserve' => 0, 'follow_links' => 0, 'force_write' => 0, 'set_permission' => &File::NCopy::u_chmod, 'file_check' => &File::NCopy::f_check, 'set_times' => &File::NCopy::s_times, ); set_permission will take two file names, the original to get the file permissions from and the new file to set the file permissions for. file_check takes two parameters, the file names to check the file to copy from and the file to copy to. I am using flock for Unix systems. Default for this is &File::NCopy::f_check. On Unix you can also use &File::NCopy::unix_check. This one compares the inode and device numbers. set_times is used if the preserve attribute is true. It preserves the access and modification time of the file and also attempts to set the owner of the file to the original owner. This can be useful in a script used by root, though enyone can preserve the access and modification times. This also takes two arguments. The file to get the stats from and apply the stats to. On Unix boxes you shouldn't need to worry. On other system you may want to supply your own sub references. $file = File::NCopy->new(recursive => 1); $file->copy "file","other_file"; $file->copy "directory1","directory2"; $file = File::NCopy->new(u_chmod => &my_chmod,f_check => &my_fcheck); $file->copy "directory1","directory2"; DESCRIPTION
File::NCopy::copy copies files to directories, or a single file to another file. You can also use a reference to a file handle if you wish whem doing a file to file copy. The functionality is very similar to cp. If the argument is a directory to directory copy and the recursive flag is set then it is done recursively like cp -R. In fact it behaves like cp on Unix for the most part. If called in array context, an array of successful copies is returned, otherwise the number of successful copies is returned. If passed a file handle, it's difficult to make sure the file we are copying isn't the same that we are copying to, since by opening the file in write mode it gets pooched. To avoid this use file names instead, if at all possible, especially for the to file. If passed a file handle, it is not closed when copy returns, files opened by copy are closed. copy Copies a file to another file. Or a file to a directory. Or multiple files and directories to another directory. Or a directory to another directory. Wildcard arguments are expanded, except for the last argument which should not be expanded. The file and directory permissions are set to the orginating file's permissions and if preserve is set the access and modification times are also set. If preserve is set then the uid and gid will also be attempted to be set, though this may only for for the men in white hats. In list context it returns all the names of the files/directories that were successfully copied. In scalar context it returns the number of successful copies made. A directory argument is considerd a single successful copy if it manages to copy anything at all. To make a directory to directory copy the recursive flag must be set. cp Just calls copy. It's there to be compatible with File::Copy. new If used then you can treat this as an object oriented module with some configuration abilities. recursive If used as an object then you can use this to set the recursive attribute. It can also be set when instantiating with new. The other attributes must all be set when instantiating the object. If it isn't specified then directories are not followed. preserve Attempt to preserve the last modification and access time as well as user and group id's. This is a useful feature for sysadmins, though the access and modification time should always be preservable, the uid and gid may not. follow_links If the link is to a directory and this attribute is true then the directory is followed and recursively copied. Otherwise a link is made to the root directory the link points to. eg. /sys/ is a link to /usr/src/sys/ is a link to /usr/src/i386/sys then the link /sys/ is actually created in the source directory as a link to /usr/src/i386/sys/ rather than /usr/src/sys/ since if the link /usr/src/sys/ is removed then we lost the link even though the directory we originally intended to link to still exists. force_write Force the writing of a file even if the permissions are read only on it. EXAMPLE
See SYNOPSIS. BUGS
When following links the target directory might not exactly the same as the source directory. The reason is that we have to make sure we don't follow circular or dead links. This is really a feature though the result may not quite resemble the source dir, the overall content will be the same. :) From Ken Healy (Version 0.34) On Win32, The use of backslash for paths is required. AUTHOR
Gabor Egressy gabor AT vmunix.com Copyright (c) 1998 Gabor Egressy. All rights reserved. All wrongs reversed. This program is free software; you can redistribute and/or modify it under the same terms as Perl itself. Some ideas gleaned from File::Copy by Aaron Sherman & Charles Bailey, but the code was written from scratch. Patch at versions 0.33, and 0.34 added by MZSANFORD. 0.35, 0.36 - Alexandr Ciornii (alexchorny AT gmail.com) perl v5.12.3 2011-06-18 File::NCopy(3pm)
All times are GMT -4. The time now is 02:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy