filenames

Unix sftp - mput command - transfer all files with a specific prefix

限于喜欢 提交于 2019-12-19 11:41:14
问题 I have bunch of files in a directory. But I would like to transfer to SFTP server only files starting with either ABC or XYZ . How do I filter these in my mput command? 回答1: If your files all in current directory: sftp user@server << EOF cd /destination $(for i in ABC* XYZ*; do echo "put $i"; done) EOF Output (example): Connected to server. sftp> cd /destination sftp> put ABCfoo.txt Uploading ABCfoo.txt to /destination/ABCfoo.txt ABCfoo.txt 100% 0 0.0KB/s 00:00 sftp> put XYZfoo.txt Uploading

With a utf8-encoded Perl script, can it open a filename encoded as GB2312?

谁说我不能喝 提交于 2019-12-19 11:05:24
问题 I'm not talking about reading in the file content in utf-8 or non-utf-8 encoding and stuff. It's about file names. Usually I save my Perl script in the system default encoding, "GB2312" in my case and I won't have any file open problems. But for processing purposes, I'm now having some Perl script files saved in utf-8 encoding. The problem is: these scripts cannot open the files whose names consist of characters encoded in "GB2312" encoding and I don't like the idea of having to rename my

Batch script to create folders based on filenames

*爱你&永不变心* 提交于 2019-12-19 10:45:11
问题 I have a folder with a lot of PNG images that I want to create folders for based on their filenames. I would then want the files to be moved into their respective folders of the same name and renamed to 0000.png. Example: - abcd.png - efghi.png - jklm.png - nopqr.png - stuv.png - wxyz.png To: - abcd/0000.png - efghi/0000.png - jklm/0000.png - nopqr/0000.png - stuv/0000.png - wxyz/0000.png 回答1: from the command line for /f %f in ('dir *.png /b') do md %~nf & move %f .\%~nf\0000.png if in the

Lua global variable containing path to current file?

我怕爱的太早我们不能终老 提交于 2019-12-19 07:09:13
问题 Is there a global variable in Lua that contains the path to the file currently being interpreted? Something like Python's __file__ variable? I ran a quick for k, v in pairs(_G) do print(k) end in the interpreter to see if I could find anything. Only the following variables were listed? string xpcall package tostring print os unpack require getfenv setmetatable next assert tonumber io rawequal collectgarbage getmetatable module rawset math debug pcall table newproxy type coroutine _G select

How can I write out multiple files with different filenames in R

三世轮回 提交于 2019-12-19 04:46:15
问题 I have one BIG file (>10000 lines of data) and I want write out a separate file by ID. I have 50 unique ID names and I want a separate text file for each one. Here's what Ive got so far, and I keep getting errors. My ID is actually character string which I would prefer if I can name each file after that character string it would be best. for (i in 1:car$ID) { a <- data.frame(car[,i]) carib <- car1[,(c("x","y","time","sd"))] myfile <- gsub("( )", "", paste("C:/bridge", carib, "_", i, ".txt"))

Bash extracting file basename from long path

我与影子孤独终老i 提交于 2019-12-18 19:15:27
问题 In bash I am trying to glob a list of files from a directory to give as input to a program. However I would also like to give this program the list of filenames files="/very/long/path/to/various/files/*.file" So I could use it like that. prompt> program -files $files -names $namelist If the glob gives me : /very/long/path/to/various/files/AA.file /very/long/path/to/various/files/BB.file /very/long/path/to/various/files/CC.file /very/long/path/to/various/files/DD.file /very/long/path/to

C# - Append Number To File Being Saved

佐手、 提交于 2019-12-18 16:27:08
问题 I have created a screenshot program and all is working great. The only problem is, I am not sure how I can make it so the screenshots are saved with appending numbers. Example: Screenshot 1, Screenshot 2, Screenshot 3, Screenshot 4, etc. Obviously this could be applied to other files being saved. Any ideas? Thank you. 回答1: Here is a method I use frequently for this very case. Just pass in a string like "Screenshot" and it will find the lowest available filename in the format of "Screenshot

What characters are allowed in a iOS file name?

蹲街弑〆低调 提交于 2019-12-18 14:05:15
问题 I'm looking for a way to make sure a string can be used as a file name under iOS. I'm currently in the section of the code that deletes incompatible characters. I'm wondering if I'm doing it right. NSString *filename = @"A file name"; fileName = [fileName stringByTrimmingCharactersInSet: [NSCharacterSet controlCharacterSet]]; fileName = [fileName stringByTrimmingCharactersInSet: [NSCharacterSet newlineCharacterSet]]; I'm also wondering if there's already a method that validates a string as a

Base64 Encoding safe for filenames?

旧城冷巷雨未停 提交于 2019-12-18 12:13:03
问题 Is Base64 encoding safe to use for filenames on Windows and Linux systems? From my research I have found that replacing all / characters of the result with - or _ should resolve any issues. Can anyone provide more details on this? Currently in Java I am using the following peice of code: MessageDigest md5Digest = MessageDigest.getInstance("MD5"); md5Digest.reset(); md5Digest.update(plainText.getBytes()); byte[] digest = md5Digest.digest(); BASE64Encoder encoder = new BASE64Encoder(); hash =

Base64 Encoding safe for filenames?

穿精又带淫゛_ 提交于 2019-12-18 12:12:10
问题 Is Base64 encoding safe to use for filenames on Windows and Linux systems? From my research I have found that replacing all / characters of the result with - or _ should resolve any issues. Can anyone provide more details on this? Currently in Java I am using the following peice of code: MessageDigest md5Digest = MessageDigest.getInstance("MD5"); md5Digest.reset(); md5Digest.update(plainText.getBytes()); byte[] digest = md5Digest.digest(); BASE64Encoder encoder = new BASE64Encoder(); hash =