Ubuntu map system files or folders in Linux copy and move folders, count the number of files or pictures in the current folder, decompress rar archives

1. Copy the folder to arbitrarily specify the folder path

cp space -r space/path/space/path/ (may be a bit slow), and finally copy the train folder to the zj1 folder

cp -r /home/sdb/hx/WKL/data_set/flower_data/train/ /home/sdb/hx/WKL/zjdata/zj1/

2. Move the folder to the specified directory, file, compressed package

(base) hx@hzsfxy-SYS-4028GR-TR2:~/WKL/zjdata/训练集$ mv "/home/sdb/hx/WKL/zjdata/训练集/female/" "/home/sdb/hx/WKL/zjdata/训练集/data/"
(base) hx@hzsfxy-SYS-4028GR-TR2:~/WKL/zjdata/训练集$ mv "/home/sdb/hx/WKL/zjdata/训练集/male/" "/home/sdb/hx/WKL/zjdata/训练集/data/"

3. Count the number of pictures in the current folder in Linux

(base) ▒hx@hzsfxy-SYS-4028GR-TR2:~/WKL/zjdata/训练集/母腹部圆$ ls -lhr|grep '.jpg'|wc -l

733
#文件夹及文件
(base) ▒hx@hzsfxy-SYS-4028GR-TR2:~/WKL/zjdata/训练集/母腹部圆$ ls | wc -w
737

4. Unzip the rar archive

1、rar命令

rar a test.rar file1 file2  #压缩

2、unrar命令

unrar e test.rar DestPath  #解压(会在把当前压缩包内容解压到当前目录内,容易造成解压内容和当前目录原文件混合,不容易区分,不建议使用)

unrar x test.rar DestPath  #解压(会在当前解压目录内产生一个以压缩包名字命名的目录,目录内是解压内容,推荐使用)

Guess you like

Origin blog.csdn.net/qq_55433305/article/details/129327250