Sponsored Content
Top Forums Shell Programming and Scripting BASH script problem using find, ideas? Post 302550924 by FortressPTH on Sunday 28th of August 2011 08:19:48 PM
Old 08-28-2011
BASH script problem using find, ideas?

Hi, I'm trying to write a script to search through my computer and
find all .jpg files and put them all in a directory. So far I have
this:
Code:
for i in `find /home -name '*.jpg' ` ; do mv $i home/allen/Pictures/PicturesFound ; done

When I run it, I get this error (this is only part of it, it goes on
for a while)
Code:
mv: cannot stat `-': No such file or directory 
mv: cannot stat `A': No such file or directory 
mv: cannot stat `Decade': No such file or directory 
mv: cannot stat `of': No such file or directory 
mv: cannot stat `Hits': No such file or directory 
mv: cannot stat `(1969-1979)/front.jpg': No such file or directory 
mv: cannot stat `/home/allen/.local/share/Trash/files/2011/03/19/00.': 
No such file or directory 
mv: cannot stat `Protest': No such file or directory 
mv: cannot stat `The': No such file or directory 
mv: cannot stat `Hero': No such file or directory 
mv: cannot stat `-': No such file or directory 
mv: cannot stat `Scurrilous': No such file or directory 
mv: cannot stat `2011': No such file or directory

Any Ideas what's wrong? I'm new to BASH, obviously. Please don't
criticize me, and try not to change my whole code, as I know there are
probably way better ways to get what I want accomplished, I just want
to get this to work. Thanks very much! hope to get a reply.

Last edited by Franklin52; 08-29-2011 at 03:49 AM.. Reason: Please use code tags for code and data samples, thank you
 

10 More Discussions You Might Find Interesting

1. Programming

Need ideas how to attack this problem

I'm at a total loss how to attack this problem. I have a file that contains ab What I need to do is if 1)if the string "ab" doesn't contain a newline, I need to insert one back into the buffer. 2)If the file contains two consecutive blank lines, skip over it. Here is what I started ... (5 Replies)
Discussion started by: frequency8
5 Replies

2. Shell Programming and Scripting

Problem with Script that writes max lines of a file - Any ideas how to fix?

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (4 Replies)
Discussion started by: mmiller99
4 Replies

3. Shell Programming and Scripting

Bash script (using find and grep)

I'm trying to make a simple search script but cannot get it right. The script should search for keywords inside files. Then return the file paths in a variable. (Each file path separated with \n). #!/bin/bash SEARCHQUERY="searchword1 searchword2 searchword3"; for WORD in $SEARCHQUERY do ... (6 Replies)
Discussion started by: limmer
6 Replies

4. Shell Programming and Scripting

Find out the day in Bash Shell script

Hello All, I need a bash shell script to find out a day from the date.For example we give the date(20100227/YYYYMMDD) then we get the day 'Saturday'. Thanks in advance, Satheesh (5 Replies)
Discussion started by: satheesh4093
5 Replies

5. Shell Programming and Scripting

Problem with bash find command

I'm trying to print all files which have the file permission 775 and that is 1MB or greater in long format. This is what I have: find -L -perm 775 -size +1000k -print when I run this script nothing appears in terminal. What am I doing wrong? (2 Replies)
Discussion started by: turdferguson
2 Replies

6. Programming

Bash Script to Find the status of URL

#!/bin/bash timevar=`date +%F_”%H_%M”` #-- > Storing Date and Time in a Variable get_contents=`cat urls.txt` #-- > Getting content of website from file. Note the file should not contain any http:// as its already been taken care of ######### Next Section Does all the processing ######### for i... (0 Replies)
Discussion started by: anishkumarv
0 Replies

7. Programming

Project ideas for GNU/Linux C and BASH development

Hello everyone... I'm trying to find an interesting project to work on for my master thesis. I like GNU/Linux C development and BASH scripting. Please give me any idea that flashes in your mind. I thank you in advance... (3 Replies)
Discussion started by: jonx
3 Replies

8. Shell Programming and Scripting

Find associated strings in a bash shell script

Hi together, unfortunately I am not a shell script guru - the following might touch the depths of awk, substr, split, regexps, where I am still fighting with - but as always the boss needs a fast solution :-( So: I have the following USER/PASSWORD-installation-config-file, from where I want to... (10 Replies)
Discussion started by: Sofie
10 Replies

9. Shell Programming and Scripting

Need ideas in shell script

Hi Gurus, I need a simple logic idea what can be done in the below shell script. I written a script to do a automated maintenance work on every month of 15th and I have scheduled it through the crontab. I need to send an alert email to the user before 24 hrs of that maintenance script run.... (5 Replies)
Discussion started by: ramkumar15
5 Replies

10. Shell Programming and Scripting

Bash find : another problem with prune

Hello. I am searching file between dates and try to apply the comments from Chubler_XL in my thread : Linux find command : how to use multiple conditions But i get a null result as i am expecting to find 32 files. Setting my computer date to the date of the thread ( 30/05/2019 ) and... (4 Replies)
Discussion started by: jcdole
4 Replies
MRENAME(1)						      General Commands Manual							MRENAME(1)

NAME
mrename - program to rename files SYNOPSIS
mrename 'pattern' prefix [option] DESCRIPTION
This manual page documents briefly the mrename command. This manual page was written for the Debian GNU/Linux distribution because the original program does not have a manual page. mrename is a tool for easy and automatic renaming of many files. The 'pattern' is the pattern to search files to rename (quoted to avoid that bash resolve it), and prefix is the prefix that will be added to the name of each file. The two alternative options for copying or moving files in the new name are explained below. All parameters are needed, and you have to stay and launch the script in the same direc- tory of the files to be renamed. The program should be able to write in this directory. OPTIONS
There are only the following three options. -c The option -c will copy each file with the new filename. -m The option -m will move each file in the new filename. -h Display help. EXAMPLE
If you have a directory with two jpeg images prof.jpg and forp.jpg and you want to add them a prefix like item0, item1 etc.. (that is item0prof.jpg, item1forp.jpg etc..) do this: cd /path/to/the/images mrename '*.jpg' item -c to copy each matching file into another with the new name mrename '*.jpg' item -m to rename each file without keeping a copy with the previous name Word-Wide-Web: http://alfalinux.sourceforge.net/mrename.php3 AUTHOR
: Giancarlo -rofus- Erra e-mail: rofus@mindless.com This manual page was written by Dr. Guenter Bechly <gbechly@debian.org>, for the Debian GNU/Linux system (but may be used by others). It is distributed under the GPL just like mrename itself. October 22, 2000 MRENAME(1)
All times are GMT -4. The time now is 07:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy