wildcard

How to remove multiple files in C using wildcards?

拟墨画扇 提交于 2021-01-26 22:57:27
问题 Is there any way in C to remove (using remove() ) multiple files using a * (wildcards)? I have a set of files that all start with Index. For example: Index1.txt , Index-39.txt etc. They all start with Index but I don't know what text follows. There are also other files in the same directory so deleting all files won't work. I know you can read the directory, iterate each file name, read the the first 5 chars, compare and if it fits then delete, but, is there an easier way (this is what I

F# How to catch all exceptions

核能气质少年 提交于 2021-01-23 06:25:31
问题 I know how to catch specific exceptions as in the following example: let test_zip_archive candidate_zip_archive = let rc = try ZipFile.Open(candidate_zip_archive.ToString(), ZipArchiveMode.Read) |> ignore zip_file_ok with | :? System.IO.InvalidDataException -> not_a_zip_file | :? System.IO.FileNotFoundException -> file_not_found | :? System.NotSupportedException -> unsupported_exception rc I am reading a bunch of articles to see if I can use a generic exception in the with , like a wildcard

Powershell - using wildcards to search for filename

瘦欲@ 提交于 2021-01-22 04:58:25
问题 I am trying to make a PowerShell script that will search a folder for a filename that contains a certain file-mask. All files in the folder will have format like *yyyyMd*.txt . I have made a script: [String]$date = $(get-date -format yyyyMd) $date1 = $date.ToString Get-ChildItem C:\Users\pelam\Desktop\DOM | Where-Object {$_.Name -like '*$date1*'} But this does not seem to work.. Can anyone help? It seems the problem is that the date variable is not correct because when I hard code something

Does String match glob pattern

被刻印的时光 ゝ 提交于 2021-01-02 08:24:39
问题 I have an array of paths, let's say: /Users/alansouza/workspace/project/src/js/components/chart/Graph.js Also I have an entry in a configuration file with additional attributes for this path in a wildcard(glob) format, as in: { '**/*.js': { runBabel: true } } Question : Is there an easy way to validate if the path matches the wildcard expression? For example: const matches = Glob.matches( '**/*.js', '/Users/alansouza/workspace/project/src/js/components/chart/Graph.js' ); if (matches) { //do

Does String match glob pattern

坚强是说给别人听的谎言 提交于 2021-01-02 08:20:30
问题 I have an array of paths, let's say: /Users/alansouza/workspace/project/src/js/components/chart/Graph.js Also I have an entry in a configuration file with additional attributes for this path in a wildcard(glob) format, as in: { '**/*.js': { runBabel: true } } Question : Is there an easy way to validate if the path matches the wildcard expression? For example: const matches = Glob.matches( '**/*.js', '/Users/alansouza/workspace/project/src/js/components/chart/Graph.js' ); if (matches) { //do

How to use wild cards in SQLAlchemy? [duplicate]

和自甴很熟 提交于 2020-12-15 05:58:48
问题 This question already has an answer here : CS50: LIKE operator, variable substitution with % expansion (1 answer) Closed last year . I'm trying to use wildcards for a query using SQLAlchemy but I'm getting back an empty list. My code: engine = create_engine(os.getenv("DATABASE_URL")) db = scoped_session(sessionmaker(bind=engine)) s = input("Search for a book: ") q = db.execute(f"SELECT * FROM books WHERE isbn LIKE '%\:s\%' OR author LIKE '%\:s\%' OR title LIKE '%\:s\%'", {"s": s}).fetchall()

How to use wild cards in SQLAlchemy? [duplicate]

安稳与你 提交于 2020-12-15 05:58:21
问题 This question already has an answer here : CS50: LIKE operator, variable substitution with % expansion (1 answer) Closed last year . I'm trying to use wildcards for a query using SQLAlchemy but I'm getting back an empty list. My code: engine = create_engine(os.getenv("DATABASE_URL")) db = scoped_session(sessionmaker(bind=engine)) s = input("Search for a book: ") q = db.execute(f"SELECT * FROM books WHERE isbn LIKE '%\:s\%' OR author LIKE '%\:s\%' OR title LIKE '%\:s\%'", {"s": s}).fetchall()