Create a dummy file in all directories that include a .jpg
Hello. My latest project has me with the need for the following script. Basically, any directory that includes a .jpg file needs to also have a ".picture" file created (if it doesn't exist). Here's an example of what I need.
In this example, I want to recursively scan all directories in /mnt/user/Pictures/, and create the .picture file in any directory that has a .jpg file within it (/mnt/user/Pictures/2011/Hawaii - 2011/, for example, does not include a .jpg file). The only directory that would need the .picture file in this example would be /mnt/user/Pictures/2012/Mammoth - family - 2012/. This .picture file is an empty dummy file, and can created as simply as "echo > .picture".
I don't mind recreating the .picture file in each directory, regardless of if it already exists or not. I thought it might be cleaner to only create it if it's needed, but it's not that big of a deal to recreate it each time regardless.
Any thoughts on the code for this script? I started going down the path of using:
... however, I quickly hit a brick wall after that.
When I try this solution, I get the following error:
xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option
Quote:
Originally Posted by Corona688
I'd try looking for folders instead, so you don't have to extract what picture's in what folder. Seems easier to do vice-versa.
When I try this solution, it doesn't seem to copy the .picture files to the folders. It seems to finish fine, but none of the folders have the .picture file. I tried changing the touch "$FOLDER"/.picture command to echo $FOLDER, and nothing was echo'd.
In the bash below I am trying to create sub-directories inside a directory from files with specific .bam extensions. There may be more then one $RDIR ing the directory and the .bam file(s) are trimmed (removing the extension and IonCode_0000_) and the result is the folder name that is saved in... (2 Replies)
Dear Team,
Can any one please let me know, if there is any way to create pdf of a Jpg image file in shell script.
I work on Solaris, Korn Shell.
Currently we are using sunpcl2pdf.exe to create PDF from PCL(Printer Control Language) files.
But we are searching for some different way to... (2 Replies)
Hi,
Need help ...I want to create multiple directories in different /file systems using for loop..eg.../ORCL_data01/oradata/orcl/ctl.
../ORCL_data01/oradata/orcl/data.
../ORCL_data01/oradata/orcl/redo.
Script :-
=========
for dir in `ls -d... (8 Replies)
Hi!
On my Ubuntu I have thousands of files in a couple hundred directories. I'm trying to convert the pdf's to jpg's.
I used this command in terminal:
for fname in *.pdf; do convert $fname ${fname%.pdf}.jpg; doneIt works great but the problem is I have to run this in terminal for each... (2 Replies)
hi,
i want to create a dummy file even if the path to that file is not exist as follows.
suppose, in my working directory 2 files are there. and
i create one more file which is exist as follows
# pwd
/home/satya
# ls
file1.txt file2.txt
# echo dummy > /home/satya/file3.txt
# ls... (3 Replies)
Hi,
On server there is an one folder . which contains sub folder
Eg - TEST folder contains
test1, test2, execr ,tt (folder). also includes some text file like abc.txt psp.txt gg.log.
here iwant to create tgz file for all the folders and file in one time.
I know the command... (1 Reply)
Hi ,
I 'm trying to check if multiple directories exist on a server, if not create the missing ones and print " creating missing directory.
how to write this in a simple script, I have made my code complex
if ; then
taskStatus="Schema extract directory exists, checking if SQL,Count and... (7 Replies)
Hi,
I have a sql file which has CREATE and INSERT commands in it. Basically, inside this file, a table will be created and the data will be inserted into the table. I was wondering if there is a way for me to create directories from this file?
Thanks in advance (4 Replies)
On SCO Openserver we create a so called dummy printer that directs to /dev/null (we use this in our software to purge some stuff).
Now I have SCO UnixWare 7.1.4, but I cannot create a dummy printer. I create the printer exactly as in Openserver by the Printer Manager,
- Enter spoolname
-... (1 Reply)