few more shell doubts

General support questions
Post Reply
knzzz
Posts: 157
Joined: 2017/02/25 12:41:42

few more shell doubts

Post by knzzz » 2018/01/20 18:04:24

Hi Team,

1.if i want to move mutiple files from my current folder to another folder instead of using one by one is it possible by using parathesis

mv FILE NAME /path/of/folder

2. How to go to particular line of the script in case if the condition is not satisfied

Regards
Kanna

desertcat
Posts: 843
Joined: 2014/08/07 02:17:29
Location: Tucson, AZ

Re: few more shell doubts

Post by desertcat » 2018/01/20 19:09:15

knzzz wrote:Hi Team,

1.if i want to move mutiple files from my current folder to another folder instead of using one by one is it possible by using parathesis

mv FILE NAME /path/of/folder

2. How to go to particular line of the script in case if the condition is not satisfied

Regards
Kanna
OK Call me LAZY but my favourite must have utility is called Midnight Commander (mc) which is an improved version of the old DOS Utility made famous by Norton Utilities call Norton Commander. You can set it up so you can have two "windows" open. In one you highlight the files you want to move or copy; in the other the destination directory or folder you want to move those files to. Hit F5 and presto the files are copied or moved to the destination directory or folder. If you want to delete them from the original folder you hight them again and hit F8 -- Gone!! You can also edit files, make new directories, etc., etc., etc. Unless you are wedded to the CLI, or happen to like pain, install mc [yum install mc], and you'll never look back again!!

kt53
Posts: 48
Joined: 2016/05/12 05:12:02

Re: few more shell doubts

Post by kt53 » 2018/01/21 02:19:04

$ mkdir test1 test2
$ cd test1
test1 $ touch file1 file2 file3
test1 $ ls
file1 file2 file3
test1 $
test1 $ mv file1 file2 file3 ../test2
test1 $ cd ../test2
test2 $ ls
file1 file2 file3
test2 $ mv file* ../test1
test2 $ cd ../test1
test1 $ ls
file1 file2 file3
test1 $

desertcat
Posts: 843
Joined: 2014/08/07 02:17:29
Location: Tucson, AZ

Re: few more shell doubts

Post by desertcat » 2018/01/21 07:36:10

kt53 wrote:$ mkdir test1 test2
$ cd test1
test1 $ touch file1 file2 file3
test1 $ ls
file1 file2 file3
test1 $
test1 $ mv file1 file2 file3 ../test2
test1 $ cd ../test2
test2 $ ls
file1 file2 file3
test2 $ mv file* ../test1
test2 $ cd ../test1
test1 $ ls
file1 file2 file3
test1 $
Which proves my point: you have to do all this typing, or you can use mc. It is far easier especially if you are constantly moving a lot of files, creating a lot of directories, or editing files to use mc.

kt53
Posts: 48
Joined: 2016/05/12 05:12:02

Re: few more shell doubts

Post by kt53 » 2018/01/21 16:05:11

NO. You do NOT need to do all these typing.

These were written to teach you how to use the mv command in Linux.

All you need to do is:

$ mv file1 file2 file3 /path-to-target-directory

pjsr2
Posts: 614
Joined: 2014/03/27 20:11:07

Re: few more shell doubts

Post by pjsr2 » 2018/01/22 09:58:20

CentOS comes with manual pages for all commands, which are accessed through the command "man". Study the output of the following command carefully:

Code: Select all

man mv

Post Reply