Sponsored Content
Top Forums Shell Programming and Scripting Delete files except the file names available in the Except File Post 302968594 by kban on Friday 11th of March 2016 11:39:00 AM
Old 03-11-2016
Delete files except the file names available in the Except File

Hi,

I need some help in the below scenario.

I need to delete all the files from the directory except the file name available in the Except file.

Like the folder ABC have files like A1.txt,A2.txt......A10.txt
and also have a file named Except.txt with the content A3.txt,A4.txt

Need a unix command to delete all the files from the folder ABC except the files A3.txt,A4.txt looking up on the Except.txt file.

Thanks for the response.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How can I delete files using a file that containt path and names?

Recentily i receive virus ninda and my network was files *.eml. I find all *.eml with: find / -name *.eml -print > virus Virus has the path and name of the file,so, How can i delete all *.eml? Thanks (2 Replies)
Discussion started by: AlvaroD
2 Replies

2. UNIX for Dummies Questions & Answers

how to delete file names with $ in them

I'm reading the file name from a spreadsheet then creating a data file with several remove statements. i.e cd /sun/5.0/AWBE/v1.0/svr/VaultLocs/CPVaultLoc/ rm "ZXCV KTest Stat host $$ cont.xls" cd /sun/5.0/AQE/v1.0/svr/VaultLocs/CPVaultLoc/ rm "ABC PMT OzLtr.pdf" cd... (2 Replies)
Discussion started by: orahi001
2 Replies

3. Shell Programming and Scripting

Insert file names when concatenate files into a file

Hi I found the following line would concatenate all test_01 test_02 test_03 files into "bigfile". cat test_* >> bigfile But, what I'm looking for a way to insert each file names in order when concatenated in "bigfile". Thank you samky2005 (2 Replies)
Discussion started by: samky2005
2 Replies

4. Shell Programming and Scripting

Searching for file names in a directory while ignoring certain file names

Sun Solaris Unix Question Haven't been able to find any solution for this situation. Let's just say the file names listed below exist in a directory. I want the find command to find all files in this directory but at the same time I want to eliminate certain file names or files with certain... (2 Replies)
Discussion started by: 2reperry
2 Replies

5. Shell Programming and Scripting

How to split a data file into separate files with the file names depending upon a column's value?

Hi, I have a data file xyz.dat similar to the one given below, 2345|98|809||x|969|0 2345|98|809||y|0|537 2345|97|809||x|544|0 2345|97|809||y|0|651 9685|98|809||x|321|0 9685|98|809||y|0|357 9685|98|709||x|687|0 9685|98|709||y|0|234 2315|98|809||x|564|0 2315|98|809||y|0|537... (2 Replies)
Discussion started by: nithins007
2 Replies

6. UNIX for Dummies Questions & Answers

To delete the oldest files in a file when file count in the folder exceeds 7

Hi All, I need to delete the oldest file in folder when the file count in the folder exceed 6 ( i have a process that puts the source files into this folder ) E.x : Folder : /data/opt/backup 01/01/2012 a.txt 01/02/2012 b.txt ... (1 Reply)
Discussion started by: akshay01987
1 Replies

7. UNIX for Dummies Questions & Answers

Delete files whose file names are listed in a .txt file

hi, I need a help. I used this command to list all the log files which are for more than 10 days to a text file. find /usr/script_test -type f -mtime +10>>/usr/ftprm.txt I want all these files listed in the ftprm.txt to be ftp in another machine and then rm the files. Anyone can help me... (8 Replies)
Discussion started by: kamaldev
8 Replies

8. Shell Programming and Scripting

Exclude certain file names while selectingData files coming in different names in a file name called

Data files coming in different names in a file name called process.txt. 1. shipments_yyyymmdd.gz 2 Order_yyyymmdd.gz 3. Invoice_yyyymmdd.gz 4. globalorder_yyyymmdd.gz The process needs to discard all the below files and only process two of the 4 file names available ... (1 Reply)
Discussion started by: dsravanam
1 Replies

9. Shell Programming and Scripting

While loop a file containing list of file names until the files are found?

Hi, I have a control file which will contain all filenames(300) files. Loop through all the file names in the control files and check the existence of this file in another directory(same server). I need to infinitely(2 hrs) run this while loop until all the files are found. Once a file is found,... (5 Replies)
Discussion started by: laknar
5 Replies

10. Shell Programming and Scripting

Compare Only "File Names" in 2 Files with file lists having different directory structure

I have a tar arcive arch_all.tar.gz and 4 batched tar archive . These batches are supposed to have all the files form arch1.all.tar.gz arch1_batch1.tar.gz arch1_batch2.tar.gz arch1_batch3.tar.gz arch1_batch4.tar.gz my issue is that the directory structure in "arch_all.tar.gz" is... (6 Replies)
Discussion started by: sumang24
6 Replies
GPHOTO2(1)																GPHOTO2(1)

NAME
gphoto2 - command-line gphoto2 client SYNOPSIS
gphoto2 [--debug] [-q | --quiet] [-v | --verbose] [-h | --help] [--list-cameras] [--usb-usermap-script NAME] [--print-usb-usermap] [--list-ports] [--stdout] [--stdout-size] [--auto-detect] [--port PATH] [--speed SPEED] [--camera MODEL] [--filename FILENAME] [--usbid USBID] [-a | --abilities] [--folder FOLDER] [[-R | --recurse] | --norecurse] [-l | --list-folders] [-L | --list-files] [-m NAME | --mkdir NAME] [-r NAME | --rmdir NAME] [-n | --num-files] [-p RANGE | --get-file RANGE] [-P | --get-all-files] [-t RANGE | --get-thumbnail RANGE] [-T | --get-all-thumbnails] [-r RANGE | --get-raw-data RANGE] [--get-all-raw-data] [--get-audio-data RANGE] [--get-all-audio-data] [-d RANGE | --delete-file RANGE] [-D | --delete-all-files] [-u FILENAME | --upload-file FILENAME] [--capture-preview] [--capture-image] [--capture-movie] [--capture-sound] [--capture-show-info RANGE] [--summary] [--manual] [--about] [--shell] DESCRIPTION
gphoto2(3) is a cross-platform digital camera library, and gphoto2(1) is a command-line client for it. Where an option takes a range of files, thumbnails, or other data, they are numbered beginning at 1. A range is a comma-separated list of numbers or spans (``first-last''). Ranges are XOR (exclusive or), so that ``1-5,3,7'' is equivalent to ``1,2,4,5,7''. --debug Turn on debugging. -q, --quiet Quiet output (default=verbose). -v, --version Display version and exit. -h, --help Display a short usage message. --list-cameras List supported camera models. --usb-usermap-script NAME Use NAME as the hotplug usb script used in the output of --print-usb-usermap. Default is "usbcam". --print-usb-usermap For every camera supported by your version of gphoto2, print the corresponding line for inclusion into the usb.usermap hotplug con- fig file. The script name used in these lines is specified with the --usb-usermap-script option. --list-ports List supported port devices. --stdout Send file to stdout. --stdout-size Print filesize before data. --auto-detect List auto-detected cameras. --port PATH Specify port device. --speed SPEED Specify serial transfer speed. --camera MODEL Specify camera model. Most model names contain spaces: remember to enclose the name in quotes so that the shell knows it is one parameter. For example: --camera "Kodak DC240". --filename FILENAME Specify a filename. --usbid USBID (Expert only) Override USB IDs. -a, --abilities Display camera abilities. -f, --folder FOLDER Specify camera folder (default="/"). -R, --recurse Recursion (default for download). --no-recurse No recursion (default for deletion). -l, --list-folders List folders in folder. -L, --list-files List files in folder. -m, --mkdir NAME Create a directory. -r, --rmdir NAME Remove a directory. -n, --num-files Display number of files. -p, --get-file RANGE Get files given in range. -P, --get-all-files Get all files from folder. -t, --get-thumbnail RANGE Get thumbnails given in range. -T, --get-all-thumbnails Get all thumbnails from folder. -r, --get-raw-data RANGE Get raw data given in range. --get-all-raw-data Get all raw data from folder. --get-audio-data RANGE Get audio data given in range. --get-all-audio-data Get all audio data from folder. --delete-files RANGE Delete files given in range. --delete-all-files Delete all files in folder. -u, --upload-file FILENAME Upload a file to camera. --capture-preview Capture a quick preview. --capture-image Capture an image. --capture-movie Capture a movie. --capture-sound Capture an audio clip. --show-info RANGE Show info. --summary Summary of camera status. --manual Camera driver manual. --about About the camera driver. --shell Start the gphoto2 shell, an interactive environment. See SHELL MODE for a detailed description. SHELL MODE
The following commands are available: cd Change to a directory on the camera. lcd Change to a directory on the local machine. exit, quit, q Exit the gphoto2 shell. get Download the file to the current directory. get-thumbnail Download the thumbnail to the current directory. get-raw Download raw data to the current directory. show-info Show information. delete Delete a file or directory. show-exif Show EXIF information (only if compiled with EXIF support). help, ? Displays command usage. ls List the contents of the current directory on the camera. SEE ALSO
gphoto2(3), gphoto2.txt, gphoto2-cli.txt, http://www.gphoto.org/ EXAMPLES
gphoto2 --list-files List files on camera. gphoto2 --get-file 7-13 Get files number 7 through 13 from the list output by gphoto2 --list-files. gphoto2 --usb-usermap-script gphoto2cam --print-usb-usermap >> /etc/hotplug/usb.usermap Append a line to the hotplug config file /etc/hotplug/usb.usermap for every supported camera, using /etc/hotplug/usb/gphoto2cam for setting up permissions correctly. AUTHOR
The gPhoto2 Team. Man page edited by Tim Waugh <twaugh@redhat.com>. February 2002 GPHOTO2(1)
All times are GMT -4. The time now is 03:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy