What's the best way to check file permissions before moving files if needed?
Hello,
I would like to know if it's a good practice to check the file permissions of the contents of a directory before moving them. For example:
The variables $directory and $destination contain the path to an existing directory. The problem is that I don't have control of the user's directory who runs the script so, in theory, the files may not have the needed permissions to be moved, and the directory is required to be empty. What's a good way to check if every file was moved successfully?
The first thing that came to mind is to check the exit status of the command:
However, this doesn't mean a file couldn't be moved, because it can also exit because of a non-existing directory entry as a result of the glob. I also thought of checking if the directory is actually empty:
But I'd like to know if this check is unnecessary. I also thought about checking if every single file has the needed permissions before using the mv command, but I'm afraid that would be superfluous.
Thanks in advance.
What I need to do is: I need to use the grep command to search for pattern in directory and sub-directories. And also I need to show the permission of file been seached by the grep command.
Could any one please suggest me?
-----------------
$> cat file1.txt
A
-----------------... (8 Replies)
I am new to shell scripting. Can someone help me out with this one please?
I need to write a script fot the following scenario:
I am currently in /parent directory.
I have a set of files in /parent/error_files directory
My script has to search for a file in /parent/erratic_files... (1 Reply)
hello,
I have to write a script to run the other script inside it.So iam planning to write like this?
first check the perimissions of the file.
Alogorthim
----------
if(!filepermissions == execute)
then
echo" Permissions denined"
else
execute the script.
file name is : load_mf.sh... (1 Reply)
Hi
I am want to create a script where the file gets moved from the current folder to a folder transfer based on the oldest first. This script should run one file at a time using a loop. I want it as a loop because I want to do some processing while I have one file. Can anyone guide me on this? (2 Replies)
Hi,
I have a directory having so many number of files. Now I want to move the files which are older than one month (lets say) from this directory to another directory (say BKP dir).
Simply, if file is olderthan one month move it from source1 dir to BKP1 dir.
My file names doesn't have... (7 Replies)
Hi,
For a particular set of files, am trying to check if they are writable. i.e., checking whether they are having permissions greater than 755.
Am able to check this using the statement:
"if (os.path.isfile(FILE_PATH) and (os.stat(FILE_PATH).st_mode & 0777) == 0777):"
But the problem here... (0 Replies)
Hi,
For a particular set of files, am trying to check if they are writable. i.e., checking whether they are having permissions greater than 755.
Am able to check this using the statement:
"if (os.path.isfile(FILE_PATH) and (os.stat(FILE_PATH).st_mode & 0777) == 0777):"
But the problem... (1 Reply)
Hi All,
I have multiple files in the folder, I want to move those files into the other folder on based of name
File names:
Template_server1_01==>
Template_server1_02==>To one directory /Server1
Template_server1_03==>
Template_server2_01==>
Template_server2_02==>To one... (9 Replies)
Is there a way to check when the permissions for the file got changed in AIX
IS there some file which logs all these details?
Best regards,
Vishal (4 Replies)
This is the content of my directory
c_g_se1_gb.ph
c_g_se1_gb.ph_pl_s.t
c_g_se1_gb.ph_pl_tr.t
c_g_se3_gb.ph
c_g_se3_gb.ph_pl_s.t
c_g_se3_gb.ph_pl_tr.t
c_g_se2_gb.ph
c_g_se2_gb.ph_pl_s.t
c_g_se2_gb.ph_pl_tr.t
c_g_se4_gb-1.ph
c_g_se4_gb-1.ph_pl_s.t
c_g_se4_gb-1.ph_pl_tr.t... (9 Replies)
Discussion started by: sammy777888
9 Replies
LEARN ABOUT HPUX
set_directory_skulk
set directory to skulk(1m) set directory to skulk(1m)NAME
set directory to skulk - Starts the skulk of a directory immediately
SYNOPSIS
cdscp set directory directory-name to skulk
ARGUMENTS
The full name of the directory.
DESCRIPTION
The set directory to skulk command starts the skulk of a directory immediately. The CDS control program prompt cdscp> does not return
until the skulk is complete. The amount of time for the skulk to complete is dependent on the location, number, and availability of repli-
cas of the directory.
Privilege Required
You must have administer, write, insert, or delete permission to the directory. The server principal needs administer, read, and write
permission to the directory.
NOTE
This command is replaced at Revision 1.1 by the dcecp command and may not be provided in future releases of DCE.
EXAMPLE
The following command initiates a skulk on the /.:/admin directory: cdscp> set directory /.:/admin to skulk
RELATED INFORMATION
Commands: add directory(1m), create directory(1m), delete directory(1m), list directory(1m), remove directory(1m), set directory to new
epoch(1m), show directory(1m)
set directory to skulk(1m)