Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Moving file using shell script fails occasionally Post 303046065 by RudiC on Wednesday 22nd of April 2020 04:17:10 PM
Old 04-22-2020
Quote:
Originally Posted by Sac
.
.
.
when i add the script to cronjob, am getting file count mismatch.

Ex: If 1000 files got copied in one day then only 950/960 are moved.

A bit difficult to believe. Pls add facts: file names / count to be copied, file names / count that have been copied, script.source.file's content, error messages, permissions on target directoroies / files, ...
And, don't underestimate MadeInGermany's hint: with $SOURCEONEACTUAL a relative path, applying cd $SOURCEONEACTUAL several times you'll end up in ./a/a/a..., i.e. nirwana.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need shell script for moving file one by one

#SD=source dir TD= target dir SD="$/amddev/app01/manoj/new/scripts/old" TD="$/amddev/app01/manoj/new/scripts/new" EXT="$*.txt" for i in `ls -F "$SD"/*"$EXT"|grep -v /$` do mv "$SD" "$TD" if then echo "$i" successfully moved echo Manoj successfully..1 ( here i... (8 Replies)
Discussion started by: manojkarthi
8 Replies

2. Shell Programming and Scripting

why shell script fails

hi .. I have automate some process on unix through sehll script . but i don't know there is some problem in scripts, some time shell script works and some time it fails. so my query is that "Why shell script fails some times?" thanks (4 Replies)
Discussion started by: tahir23
4 Replies

3. Shell Programming and Scripting

why shell script fails?

hi , i m trying to run a shell script automatically , some time it works fine but some time it fails , what could be the problem . If anybody have an idea about this problem then reply . Thanks in advacne (4 Replies)
Discussion started by: tahir23
4 Replies

4. Shell Programming and Scripting

shell script for moving all the file from the same folder

Hi , I need a shell script which basicaly moves all the files from one folder say folder x to folder y and once they are moved to folder y a datetimestamp should be attached to there name for ex file a should be moved to y folder and renamed as a_20081015 (1 Reply)
Discussion started by: viv1
1 Replies

5. Shell Programming and Scripting

Shell Script for moving 3 days old file to Archive Folder

Hi Experts, I have a "Source" folder which may contain some files. I need a shell script which should move all files which are older than 3 days to "Archive" folder. Thanks in Advance... (4 Replies)
Discussion started by: phani333
4 Replies

6. Shell Programming and Scripting

Execute shell script even if the first script fails

All, I executing a perl script and shell script from a master shell script. i will execute the perl script first and have to execute the shell script after the completion of perl execution. Below is the code i use for it, script_root='/dev/scripts' /usr/bin/perl -S $script_root/test.pl;... (5 Replies)
Discussion started by: vel4ever
5 Replies

7. Shell Programming and Scripting

How to exit from shell script if above condition fails?

HI cd ${back_home} if above back_home does not exist, then script shoul exit. Please let us know how to do that (7 Replies)
Discussion started by: buzzme
7 Replies

8. Shell Programming and Scripting

Shell Script for renaming and moving Files - Easy?

Hey guys, ive been working on this for about 2hrs now - without any solution. At first I need to say I dont have skills in linux bash scripting, but I tried to use some codesnippets and manuals from google. What I want to do: I have different folders including 2 different filestypes with... (15 Replies)
Discussion started by: peter1337
15 Replies

9. UNIX for Beginners Questions & Answers

Linux shell | how to exit a script if any command fails.

Hi, i am new here let me say HI for all. now i have a question please: i am sending one command to my machine to create 3 names. if one of the names exists then the box return error message that already have the name but will continue to create the rests. How i can break the command and... (7 Replies)
Discussion started by: Amiri
7 Replies

10. Shell Programming and Scripting

Array declared in shell script works for AIX but fails in Linux

Array declared in shell script works for AiX 6.1 and above but fails in Linux CentOS 7. I have the below code for Array in my shell script that runs fine on AiX systems. Note: on AiX it uses ksh shell while on Linux it uses non ksh shell. set -A filelist However, i now wish to use the... (3 Replies)
Discussion started by: mohtashims
3 Replies
MKFS(8) 						      System Manager's Manual							   MKFS(8)

NAME
mkfs, mkext - archive or update a file system SYNOPSIS
disk/mkfs [-aprv] [-n name] [-s source] [-u users] [-z n] proto ... disk/mkext [-d name] [-u] [-h] [-v] file ... DESCRIPTION
Mkfs copies files from the file tree source (default /) to a kfs file system (see kfs(4)). The kfs service is mounted on /n/kfs, and /adm/users is copied to /n/kfs/adm/users. The proto files are read, and any files specified in them that are out of date are copied to /n/kfs. Each line of the proto file specifies a file to copy. Indentation is significant, with each level of indentation corresponding to a level in the file tree. Fields within a line are separated by white space. The first field is the last path element in the destination file tree. The second field specifies the permissions. The third field is the owner of the file, and the fourth is the group owning the file. The fifth field is the name of the file from which to copy; this file is read from the current name space, not the source file tree. All fields except the first are optional. Names beginning with a are expanded as environment variables. If the first file specified in a directory is all of the files in that directory are copied. If the first file is all of the files are copied, and all subdirectories are recursively copied. Mkfs copies only those files that are out of date. Such a file is first copied into a temporary file in the appropriate destination direc- tory and then moved to the destination file. Files in the kfs file system that are not specified in the proto file are not updated and not removed. The options to mkfs are: a Instead of writing to a kfs file system, write an archive file to standard output, suitable for mkext. All files in proto, not just those out of date, are archived. n name Use kfs.name as the name of the kfs service (default kfs). p Update the permissions of a file even if it is up to date. r Copy all files. s source Copy from files rooted at the tree source. u users Copy file users into /adm/users in the new system. v Print the names of all of the files as they are copied. z n Copy files assuming kfs block n (default 1024) bytes long. If a block contains only 0-valued bytes, it is not copied. Mkext unpacks archive files made by the -a option of mkfs. The -d option specifies a directory (default /n/kfs) to serve as the root of the unpacked file system. The -u option, to be used only when initializing a new fs(4) file system, sets the owners of the files created to correspond to those in the archive and restores the modification times of the files. (This is only permitted at the initial load of the files into a file system.) Each file on the command line is unpacked in one pass through the archive. If the file is a directory, all files and subdirectories of that directory are also unpacked. When a file is unpacked, the entire path is created if it does not exist. If no files are specified, the entire archive is unpacked; in this case, missing intermediate directories are not created. The -v option prints the names and sizes of files as they are extracted; -h prints headers for the files on standard output instead of unpacking the files. EXAMPLES
Make an archive to establish a new file system: disk/mkfs -a -u files/adm.users -s dist proto > arch Unpack that archive onto a new file system: srv il!newfs mount -c /srv/il!newfs /n/newfs disk/mkext -u -d /n/newfs < arch FILES
/lib/proto directory of prototype files. /lib/proto/portproto generic prototype file. SOURCE
/sys/src/cmd/disk/mkfs.c /sys/src/cmd/disk/mkext.c SEE ALSO
prep(8), kfscmd(8), wren(3), pip(8) MKFS(8)
All times are GMT -4. The time now is 01:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy