linux ls命令shell脚本位置,linux - shell脚本到ls并在ls上执行命令结果 - SO中文参考 - www.soinside.com...

我在ubuntu的文件夹中有一个文件夹列表。即。在/ mnt / source / customcode / files / brands /下

root@a919794ec280:/mnt/source/customcode/files/brands# ls -la

total 236

drwxrwxrwx 19 1002 root 4096 Jan 3 09:26 .

drwxrwxrwx 8 1002 1003 4096 Dec 27 22:45 ..

drwxrwxr-x 3 1002 1003 4096 Jan 3 09:22 aem

drwxrwxr-x 3 1002 1003 4096 Jan 3 09:22 apple

drwxrwxr-x 3 1002 1003 4096 Jan 3 09:22 cool

drwxr-xr-x 3 1002 root 4096 Jan 3 09:22 doll

drwxr-xr-x 3 1002 root 4096 Jan 3 09:22 ent

drwxr-xr-x 3 1002 root 4096 Jan 3 09:22 f1

drwxr-xr-x 3 1002 root 4096 Jan 3 09:22 google

drwxrwxrwx 3 1002 root 4096 Jan 3 09:22 h1

drwxrwxr-x 3 1002 1003 4096 Jan 3 09:22 iq

drwxr-xr-x 3 1002 root 4096 Jan 3 09:22 king

drwxrwxrwx 3 root root 4096 Jan 3 09:22 link

drwxrwxrwx 3 1002 root 155648 Jan 3 09:22 nobrand

drwxrwxr-x 3 1002 1003 12288 Jan 3 09:22 pepperfry

drwxrwxrwx 2 1002 root 4096 Jan 3 09:22 pepsi

drwxrwxr-x 2 1002 1003 4096 Jan 3 09:22 rock

drwxrwxrwx 2 1002 root 4096 Jan 3 09:22 star9

drwxrwxr-x 2 1002 1003 4096 Jan 3 09:22 vicks

----- 100+ -----

像上面一样,我有像“a1”,“可乐”,“链接”等文件夹(超过100个文件夹)

在每个文件夹的旁边,将有一个名为“data_aug”的文件夹和“data_aug”文件夹中包含文件。

root@a919794ec280:/mnt/source/customcode/files/brands/apple# ls -la

total 1988

drwxrwxr-x 3 1002 1003 4096 Jan 3 09:22 .

drwxrwxrwx 19 1002 root 4096 Jan 3 09:26 ..

-rw-r--r-- 1 1002 1003 17465 Dec 29 23:28 0DPA0C3.jpg

-rw-r--r-- 1 1002 1003 3836 Dec 31 00:55 130418131111-apple-store-santa-monica.jpg

-rw-r--r-- 1 1002 1003 48616 Dec 31 00:52 15146774227434507677123475441338.jpg

-rw-r--r-- 1 1002 1003 9107 Dec 31 00:52 15146774615326659565665852728294.jpg

-rw-r--r-- 1 1002 1003 28005 Dec 29 23:28 3D-Apple-Logo-Wallpapers.jpg

-rw-r--r-- 1 1002 1003 75855 Dec 29 23:28 3D-Apple-Logo.jpg

-rw-r--r-- 1 1002 1003 27403 Dec 29 23:28 3d_apple_logo___wallpaper_by_techflashdesigns-d4fbc7p.jpg

-rw-r--r-- 1 1002 1003 38420 Dec 29 23:28 AX62GjL.jpg

-rw-r--r-- 1 1002 1003 6025 Dec 29 23:28 Apple-Logo-2016 (1).jpg

-rw-r--r-- 1 1002 1003 929419 Dec 29 23:28 Apple-Logo-Png-Download.png

-rw-r--r-- 1 1002 1003 35742 Dec 29 23:28 apple-logo-2016.jpg

-rw-r--r-- 1 1002 1003 15301 Dec 29 23:28 apple-logo-3d-model-max-obj-fbx-3dm-ige-igs-iges.jpg

-rw-r--r-- 1 1002 1003 42514 Dec 29 23:28 apple-logo-clipart-2.jpeg

-rw-r--r-- 1 1002 1003 152183 Dec 29 23:28 apple-logo-clouds.jpg

-rw-r--r-- 1 1002 1003 6117 Dec 31 00:55 apple1.jpg

-rw-r--r-- 1 1002 1003 349787 Dec 29 23:28 apple_ipad_logo.png

-rw-r--r-- 1 1002 1003 54167 Dec 29 23:28 b5c4d6c9-3.jpg

drwxr-xr-x 2 root root 4096 Jan 3 09:22 data_aug

-rw-r--r-- 1 1002 1003 32918 Dec 29 23:28 large.JPG

-rw-r--r-- 1 1002 1003 48972 Dec 29 23:28 medium.jpg

-rw-r--r-- 1 1002 1003 3609 Dec 29 23:28 th (1).jpeg

-rw-r--r-- 1 1002 1003 30392 Dec 29 23:28 th (2).jpeg

-rw-r--r-- 1 1002 1003 3222 Dec 29 23:28 th.jpeg

-rw-r--r-- 1 1002 1003 22544 Dec 29 23:28 u5TAcBk.jpg

root@a919794ec280:/mnt/source/customcode/files/brands/apple/data_aug# ls -la

total 4356

drwxr-xr-x 2 root root 12288 Jan 3 09:41 .

drwxrwxr-x 3 1002 1003 4096 Jan 3 09:22 ..

-rw-r--r-- 1 root root 10450 Jan 3 09:40 apple_0_1.jpeg

-rw-r--r-- 1 root root 5599 Jan 3 09:40 apple_0_1019.jpeg

-rw-r--r-- 1 root root 3225 Jan 3 09:40 apple_0_1075.jpeg

-rw-r--r-- 1 root root 10283 Jan 3 09:40 apple_0_1100.jpeg

-rw-r--r-- 1 root root 13923 Jan 3 09:41 apple_0_1119.jpeg

现在...

我需要一个脚本放在“/ mnt / source / customcode /”中

想要从“/ mnt / source / customcode /”运行脚本,因为我的脚本相关文件只能从“/ mnt / source / customcode /”执行以实现。

从所有100个文件夹中递归删除文件夹“data_aug”和“data_aug”内的数据。

然后从“/ mnt / source / customcode /”位置我应该执行一个

特殊脚本,它会引用那100个文件夹。比如说

下面。

码...

python -m scripts.augmentation_keras --image_dir=files/brands/apple --target_dir=files/brands/apple/data_aug --save_prefix=apple

python -m scripts.augmentation_keras --image_dir=files/brands/a1 --target_dir=files/brands/a1/data_aug --save_prefix=a1

像上面所有100个文件夹一样。文件夹100的数量将来会增长得更多。

我怎么能动态地做,而不是用数百行编写简单的脚本(静态删除和执行)!

谢谢。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值