简体   繁体   中英

Find files using wildcard in directory using Linux

So I have a directory that has a number of files. I'm wondering what I need to find files within that directory. My files have a naming convention and then a last name. I'd like to find by the naming convention.

/MyDir/MySubDir/2016_01_randomLastNameABC

/MyDir/MySubDir/2016_01_randomLastNameDEF

/MyDir/MySubDir/2016_01_randomLastNameGHD

/MyDir/MySubDir/2016_01_randomLastNameDGD

find "/MyDir/MySubDir/2016_01_*" 

I keep getting an error that says:

"linux file names usually don't contain slashes"

It must not like the fact that I'm trying to search a directory

尝试find ./MyDir/MySubdir/ -name "2016_01_*"

This will do

find /MyDir/MySubDir/ -name "2016_01_*"

test,

~$ find ./market/public/static/ -name *.js
./market/public/static/view3dview.js
./market/public/static/ng-file-upload.min.js
./market/public/static/codemirror-min.js
./market/public/static/model_upload_app.js
find /MyDir/MySubDir -name "2016_01_*"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM