So i've managed to get the files moved and renamed however i'm finding errors when I try to put sequential numbers after the file names, my aim would be to split these up i.e sequential numbers after each file name for each file individual file type. This is my attempt;
Any tips and advice are much appreciated!
Thanks again
As has been said several times before in this thread, you can't have spaces around the equal sign in a shell variable assignment.
Then you need to assign a value to the variable d (which I assume is intended to contain the pathname of your destination directory.
Assuming that you are trying to copy a single file to a new directory with a new name, you can only give two operands to cp; not three ($f (your source file), $d (presumably your destination directory), and "$(printf "%u" $num) . png" (which is a slow way to create a filename consisting of a number, a space, a period, a space, and the string png)).
You talked about having a base name for your files based on the final component of the pathname of your destination directory, but I don't see anything in your code that attempts to do that. There isn't anything that checks to see whether or not the calculated destination filename already exists either. Maybe you want something more like:
This won't try to number .png and .doc files separately, but will verify that an existing file won't be overwritten by a new file being copied into the destination directory. (If you want separate numbering for the different file extensions, the easy way to do it would be to break the for loop into two for loops.
All,
I need to grab and rename common files from several unique directory structures. For example, the directory structures looks like:
/unique_dir/common/common/common/person_name_dir/common_file.txt
There are over 90,000 of these text files that I'd like to put in a single directory as... (5 Replies)
Hi,
I have a folder which contains files in this format.
abc-bin.000001
abc-bin.000002
abc-bin.000003
abc-bin.000004
abc-bin.000005
abc-bin.000006
abc-bin.000007
abc-bin.000008
abc-bin.000009
abc-bin.000010
abc-bin.index
I want to copy all the files between
abc-bin.000004... (6 Replies)
Hi,
I have a shell script
#!/bin/sh
date
echo 'HI PROD'
echo $Please ENTER THE INPUT 1 for old files 2 for new file
read i
if ;
then
cd /apps/acetp3_logs/prod3/O*
pwd
echo $PLEASE ENTER THE STRING TO SEARCH (PLEASE ENTER THE STRING INSIDE QUOTES ' ')
read j
echo... (6 Replies)
Hi All,
I am doing this for svn patch making. I got the list of files to make the patch. I have the list in a file with path of all the files.
To Do
From Directory : /myproject/MainDir
To Directory : /myproject/data
List of files need to copy is in the file: /myproject/filesList.txt
... (4 Replies)
Hi All,
I'm trying to list some files from my log directory
and files are like this
log.20110302_20.gz
log.20110302_21.gz
log.20110302_22.gz
log.20110302_23.gz
log.20110303_00.gz
log.20110303_01.gz
log.20110303_02.gz
............
log.20110311_22.gz
log.20110311_23.gz... (2 Replies)
I am userB and have a dir
/temp1
This dir is owned by me.
How do I recursively copy files from another users's dir userA?
I need to preserve the original user who created files, original group information, original create date, mod date etc.
I tried
cp -pr /home/userA/* .
... (2 Replies)
Hi,
I understand that to copy files across server, the feasible way will be using scp command. Am I right?
What if the two servers are not connected to a network? If by using a cross cable to link up both the server, what will be the best (fastest) way to copy files across? scp as well?
... (3 Replies)
hi
I want to copy all files from the current directory and move to .archive file.
Moreover,I want to add .bak to each file name, that will be copied.
How can I do that? (4 Replies)
I am new user to solaris and installed solaris operating system on full Harddisk 120Gb. I am unable to copy music files to desktop and /home directory.
One thing happened while registering is- i entered login-root and its password. The message prompted your system is crashed. Is it because of... (1 Reply)