Sample Header Ad - 728x90

How can I download the entire contents of a directory using wget, but excluding files with a particular suffix with the use of a wildcard?

0 votes
1 answer
3898 views
I have a locally-hosted server, and am attempting to download all files to my remote Ubuntu-based machine via wget. I need to download all files from my HTTP server in a single directory, ensuring that everything apart from files with a suffix of "_test" is obtained - so in other words, I need to make sure that any file with that suffix isn't grabbed. I've tried the following command: ~~~ wget -r http://my-server-ip/data -R '*_test' ~~~ The above command results in wget fetching everything from the server - including files with the "_test" suffix. I realise that multiple examples of how to use this command correctly exist, but none appear to suit my use case. I should also note that I'm using the bash shell.
Asked by elliott94 (153 rep)
Dec 6, 2019, 10:59 AM
Last activity: May 23, 2025, 08:03 PM