Sponsored Content
Top Forums Shell Programming and Scripting Having trouble with find rename jpg command Post 302880203 by RavinderSingh13 on Wednesday 18th of December 2013 04:23:01 AM
Old 12-18-2013
Hello,

Could you please try the following code.

Code:
a=`find . -name "*.jpg"`
set -A array $a
 
for i in ${array[@]}
do
file_name=`basename $i`
echo $file_name
new_name=`echo $file_name"_m"`
cp "$file_name" "$new_name"
done


Hope this may help you.

NOTE: kindly use cp -p to copy the files in same permissions.


Thanks,
R. Singh

Last edited by RavinderSingh13; 12-18-2013 at 05:35 AM.. Reason: mentioning the use for cp -p command
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

The trouble with FIND .......

Afternoon, I have a problem with the FIND and GREP commands working together. The command that I am typing is this:- find . -name *.sql -print --- This finds all files with an SQL suffix I then want to examine all those files to check for the existence of a string in them. I am... (2 Replies)
Discussion started by: chorse
2 Replies

2. Shell Programming and Scripting

Find and rename

Hi, I was wondering if there is a way to find a particular file and then give it as an input to a program and then dump it into another file. Something like this: find ./ -name '*.txt' -exec ~/processText {} > mod.<current_file> \; I've been trying all sorts of weird things but not... (2 Replies)
Discussion started by: Legend986
2 Replies

3. Shell Programming and Scripting

Simple BASH shell script to rename webcam jpg and copy into a new directory.

System: Ubuntu Intrepid Ibex I'm running webcamd as a sort of "security" program, but I need a script that will archive my webcam.jpg files. So, take the following file: /home/slag/www/webcam.jpg Rename it--preferably with a time stamp. Place it in say: /home/slag/www/history/ ... (4 Replies)
Discussion started by: robfindlay
4 Replies

4. Shell Programming and Scripting

find jpg's mkdir script help

I am having a problem getting this to work right. The script needs to search through directories and subdirectories. If a jpg is found then create a folder in that directory, so on and so forth. Here is what I have so far but it doesn't work right. Help please #!/bin/bash for d in `find ./... (1 Reply)
Discussion started by: jedhypes
1 Replies

5. Shell Programming and Scripting

Rename all ".JPG" files to ".jpg" under all subfolders...

Hi, Dear all: One question ! ^_^ I'm using bash under Ubuntu 9.10. My question is not to rename all ".JPG" files to ".jpg" in a single folder, but to rename all ".JPG" files to ".jpg" in all subfolders. To rename all ".JPG" to ".jpg" in a single folder, for x in *.JPG; do mv "$x"... (7 Replies)
Discussion started by: jiapei100
7 Replies

6. Shell Programming and Scripting

Find and Rename files using (find mv and sed)

In response to a closed thread for degraff63 at https://www.unix.com/shell-programming-scripting/108882-using-mv-find-exec.html the following command might do it as some shells spit it without the "exec bash -c " part: Find . -name "*.model" -exec bash -c "mv {} \`echo {} | sed -e 's//_/g'\`"... (0 Replies)
Discussion started by: rupert160
0 Replies

7. Shell Programming and Scripting

find and copy script trouble

Hi guys First thing to say is that I am entirely new to Shell Scripting and am trying to write a script to do something I thought would be relatively simple, but has escaped me. Essentially, I want to take file name information from a list, find the files listed and then copy the results into... (0 Replies)
Discussion started by: acheron
0 Replies

8. Shell Programming and Scripting

Find directories with same name and rename them

Hello Im trying to make a script in bash shell programming to find subdirectories with the same name into the same directory and rename one of them!! Could you please help me? Thanks in advance (1 Reply)
Discussion started by: BTKBaaMMM
1 Replies

9. Shell Programming and Scripting

Trying to find and rename files

but it's not working. Hello all. I'm running the following command to find files with a specific name and rename them, but the command prompt returns a short 10 seconds after executing and doesn't find or rename anything. What am I doing wrong here? find . -type f | for file in... (3 Replies)
Discussion started by: bbbngowc
3 Replies

10. UNIX for Beginners Questions & Answers

Linux find jpg and sort by date

I want to find all jpg files and then sort them by modification date. This is where I started. find . -type f -name "*.jpg" I tried to pipe a sort in there but that did not seem to work. Do I need to use xargs? (10 Replies)
Discussion started by: cokedude
10 Replies
MY_PRINT_DEFAULTS(1)					       MySQL Database System					      MY_PRINT_DEFAULTS(1)

NAME
my_print_defaults - display options from option files SYNOPSIS
my_print_defaults [options] option_group ... DESCRIPTION
my_print_defaults displays the options that are present in option groups of option files. The output indicates what options will be used by programs that read the specified option groups. For example, the mysqlcheck program reads the [mysqlcheck] and [client] option groups. To see what options are present in those groups in the standard option files, invoke my_print_defaults like this: shell> my_print_defaults mysqlcheck client --user=myusername --password=secret --host=localhost The output consists of options, one per line, in the form that they would be specified on the command line. my_print_defaults supports the following options. o --help, -? Display a help message and exit. o --config-file=file_name, --defaults-file=file_name, -c file_name Read only the given option file. o --debug=debug_options, -# debug_options Write a debugging log. A typical debug_options string is 'd:t:o,file_name'. The default is 'd:t:o,/tmp/my_print_defaults.trace'. o --defaults-extra-file=file_name, --extra-file=file_name, -e file_name Read this option file after the global option file but (on Unix) before the user option file. o --defaults-group-suffix=suffix, -g suffix In addition to the groups named on the command line, read groups that have the given suffix. o --no-defaults, -n Return an empty string. o --verbose, -v Verbose mode. Print more information about what the program does. o --version, -V Display version information and exit. COPYRIGHT
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc. This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/. SEE ALSO
For more information, please refer to the MySQL Reference Manual, which may already be installed locally and which is also available online at http://dev.mysql.com/doc/. AUTHOR
Sun Microsystems, Inc. (http://www.mysql.com/). MySQL 5.1 04/06/2010 MY_PRINT_DEFAULTS(1)
All times are GMT -4. The time now is 02:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy