需要使用Unix脚本将文件名移动到具有文件路径的目录中

时间:2019-02-26 11:04:20

标签: linux bash shell unix

我尝试使用此代码:

cd /data/sources/;
ls $PWD/Asset_* >> /data/processing/asset_files.txt;

但是它仅适用于少量文件,不适用于大量文件。

如何有效地做到这一点?

2 个答案:

答案 0 :(得分:0)

您可以通过以下方式重写脚本:

cd /data/sources/
find $PWD -type f -name "Asset_*">> /data/sources/processing/asset_files.txt

答案 1 :(得分:0)

您也可以使用for循环进行此操作:

server.undertow.accesslog.dir= # Undertow access log directory.
server.undertow.accesslog.enabled=false # Whether to enable the access log.
server.undertow.accesslog.pattern=common # Format pattern for access logs.
server.undertow.accesslog.prefix=access_log. # Log file name prefix.
server.undertow.accesslog.rotate=true # Whether to enable access log rotation.
server.undertow.accesslog.suffix=log # Log file name suffix.
server.undertow.buffer-size= # Size of each buffer.
server.undertow.direct-buffers= # Whether to allocate buffers outside the Java heap. The default is derived from the maximum amount of memory that is available to the JVM.
server.undertow.eager-filter-init=true # Whether servlet filters should be initialized on startup.
server.undertow.io-threads= # Number of I/O threads to create for the worker. The default is derived from the number of available processors.
server.undertow.max-http-post-size=-1B # Maximum size of the HTTP post content. When the value is -1, the default, the size is unlimited.
server.undertow.worker-threads= # Number of worker threads. The default is 8 times the number of I/O threads.