Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
1.pls tell me the command for checking whether a given directory is empty or not .
2. can i check what is the last copied item in a directory .
and i yes , i want to move that last copied item in another directory .
pls help me with shell code for these two tasks
thanks
2. Relevant commands, code, scripts, algorithms:
ls -l displays it on terminal
3. The attempts at a solution (include all code and scripts):
ls - l does it , but i dont know how to use it for getting last entry
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
its a part of research on analysing executables.
professor M.S. gaur
MNIT jaipur
ls - l does it , but i dont know how to use it for getting last entry
Maybe it is just me, but i sense a misconception about how Unix commands work.
In fact not ls -l does it, but ls does it. "ls" is a command and it shows a directories contents. How it does this can be widely influenced by using certain options.
You already saw the "-l" option at work, which changes the display format from the default short (only filenames) to a long (filemode, owner, group, etc.) listing.
Now, here is a general rule for working with Unix: nobody knows ALL the options every command has - not a single person! This is what "man" pages are for, which you invoke by
Think of these as like a telephone directory: you don't have to know all the numbers by heart, you just have to know the name and the city. In Unix you have to know that "ls" shows directories contents and to find out how you manage to get some specific listing of these contents you look up the man page if you can find something which suits your purpose.
So i suggest you try that and report back here. If you find anything worthwile we will take it from there.
I have a script, which is supposed to run 1 day of the month, connect to remote server certain directory, find files, tar the, and copy
find . -ctime -1 | tar -cvf transfer_dmz_start_monthly.tar *${Today}*.*;
if
then
echo "Cannot create a tar file, the terminated... (2 Replies)
Hello
So i have that script collection, in which i have a single script to create a configuration file.
In there, i have multiple occourences of something like this:
prj_title=$(tui-read "What is the TITLE? ($prj_name):")
] && prj_title="${prj_name/_/ }"
They all work as expected, if... (5 Replies)
Hi gurus ,
I have two files and i want to perform different action based on the condition if both or either is empty
If
then
Do something
elif
then
do something
elif
then
do something
else
do something
fi
I have tried the below bt its not... (4 Replies)
1.pls tell me the command for checking whether a given directory is empty or not .
2. can i check what is the last copied item in a directory .
and i yes , i want to move that last copied item in another directory .
pls help me with shell code for these two tasks
thanks (1 Reply)
Hi All,
I have a requirement to check all the files in a directory and mail non empty files
Files are in csv format , i need to skip header while checking
pls help
Thanks (12 Replies)
I need to check if a directory is empty using an if condition
in the pseudocode below
if ; then
else
although i looked at a few forums on this topic, I left feeling a little unclear and i could not use the command successfully
what can i substitute in the if conditon above,... (2 Replies)
I have the list of users in user.log, under each user folder there is sub1 folder is there. i want to check whether sub1 is empty or not, if it is empty i have to skip that user user folder and iterate next user folders. i have the sample code,its not giving not proper results.
while read line... (8 Replies)
How do I check if a file is empty in a sh script
I want to test in my shell script if the output file is empty and if it is do one thing and if it isnt empty do another?
any ideas? (8 Replies)
Hi Masters.....
I have problem !!!
I need to check number of records in a file and if it is zero or file is empty i need to do some task.
if ; then
echo "File s empty"
else
echo "Not empty"
fi
so how to check this condition.
I used wc -l < filename.txt => 1 for zero records
same result... (1 Reply)
Hello All,
I have written shell script whcih at the max 3 parameters.
When only one commandline argument and other two command line arguments are passed as empty string like
eg : archive ' ' ' '
Then i need to check whether the commandline... (12 Replies)