Beginner need help how file moving script could look like
Hi there,
I am an absolut beginner in scripting.
I am using Ubuntu Linux 18.04 LTS:
I just need some hints/suggestions how a script could look like doing the following stuff:
assuming I am in directory "base_directory"
like xyz@mypc:~/base_directory$
within the "base_directory there are some subfolders (random name) having subfolder (random name)
there is a structure like:
and so on....
each of the "sub-subfolders" contains several files
like ffe.txt, dwfekt.c etc.
now would like to grap e.g. all files with .c extension of every sub-subfolder and
move all files with .c extension to e.g. folder
is there an easy way to do so?
sorry for such a dump question but I am completely new in this and want to check
how much effort it takes to implement (maybe such simple) file operations.
Best Regards
dut
Moderator's Comments:
Please use CODE tags as required by forum rules!
Last edited by RudiC; 01-25-2019 at 03:54 PM..
Reason: Added CODE tags.
Are those subdirectories always two levels deep, or is that depth arbitrary? Are the .c files only in the leaf directories, or all over the place? Do ALL .c files go into one single target directoy? Do you know about the find command, which is ideally suited for task like this?
Dear All,
I am having a database that generates daily backup files in the below format.
abc_date_0010.zip.
Can you please suggest a method to copy the last day's file to another location.
I am trying with if statement, but having difficulty while I use the condition like
if ; then
... (4 Replies)
Hi, so I have been doing ok making a relatively simple script just processing some data. However I am now at the point where im struggling to find the specific help I need.
I have files in the form of yyyy.ddd.hh.mm.ss.stationnumber.component (they are earthquake events). eg.... (12 Replies)
1. The problem statement, all variables and given/known data:
Arguments:
http://farm9.staticflickr.com/8070/8212131370_8b6e8c10c5_c.jpg
I am given these three arguments. $1, $2, $3
The first argument is the path to a directory.
So, how would I go into the directory and compare files?
I... (5 Replies)
I want to make a script that moves all files with a keyword on it to another folder. and lets me know how many files it moved with that keyword. Im a total newbie with scripting so a little help would be much appreciated. (3 Replies)
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)
I am in an intro to unix/linux course, and need some help with a project. We are tasked with creating a basic script to automate a task that an Admin might need to do. We submitted ideas and mine was to have the system keep a record of log in and log out times for users. I thought this was going... (3 Replies)
hi
i am reading files from directory,if the files matches certain condition i need to move that file to another directory
i am using
if
then
mv $file1 > $UNIQDIR
fi
but i am gettin error , please help
thanks
Satya (4 Replies)
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)
#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)
I would like to get a sample script (ksh or bash, or both so I could see the differences)
What I want to do with the script is send an daily email to myself that contains the following:
The number of files in a directory
The total size of the files in that directory
The contents of a file... (2 Replies)