filenames

Is there a standard file naming convention for key-value pairs in filename?

▼魔方 西西 提交于 2019-12-25 11:57:06
问题 I have multiple data files that are named after what they contain. For example machine-testM_pid-1234_key1-value1.log There are keys and values separated by - and _. Is there a better syntax for this? Are there parsers that automatically read these kinds of files/filenames? The idea here is that the filenames are human and machine readable. 回答1: There seems to be no standard file naming convention for key-values. 来源: https://stackoverflow.com/questions/10087079/is-there-a-standard-file-naming

VBA update filename and path upon saving

折月煮酒 提交于 2019-12-25 09:36:16
问题 I've tried using the following codes below, but none will give me an active field that will update upon saving. I want the file path and name . Maybe you can help. Thanks. ActiveDocument.Name - gives the name of the document, without path information. 回答1: As @braX says Use FullName to get the file name and path. Note FullName will only contain the file path AFTER you have saved the document once! ' Saved ActiveDocument.FullName ' -> C:\Documents\Doc1.docx ' Unsaved ActiveDocument.FullName '

How to download file with its original name instead of unique name?

我的梦境 提交于 2019-12-25 03:39:56
问题 Currently my file uploading progress is following: User select a file to upload. Then I rename user uploaded file to unique name with following PHP code: $ext = explode('.', basename( $_FILES['file1']['name'])); $file_name1 = md5(uniqid()) . "." . $ext[count($ext)-1]; After that I just upload this unique file to my 'upload_doc/' directory. Now there are a option in my script to download this uploaded file. To download, I'm just calling this unique file name from 'updload_doc/' directory and

SAS set a variable from a filename

你离开我真会死。 提交于 2019-12-25 02:41:01
问题 I have a number of csv files in a folder. They all have the same structure (3 columns). The SAS code below imports all of them into one dataset. It includes the 3 columns plus their file name. My challenge is that the filename variable includes the directories and drive letter (e.g. 'Z:\DIRECTORYA\DIRECTORYB\file1.csv'). How can I just list the file name and not the path (e.g. file1.csv)? Thank you data WORK.mydata; %let _EFIERR_ = 0; /* set the ERROR detection macro variable */ length FNAME

Rename filename using another files name from the same folder

寵の児 提交于 2019-12-25 02:01:31
问题 I currently have a windows folder with only two files in it: vacation.jpg and summer.avi What I want to to is rename summer.avi in vacation.avi by using the text that is before the .jpg extension. So for example if I have another folder with christmas.jpg and summer.avi the .avi file would be renamed into christmas.avi. Any help would be much appreciated! 回答1: You can use the ~n parameter extension to grab just the filename without the extension. The script needs to be in the same directory

Move files to directories based on some part of file name?

与世无争的帅哥 提交于 2019-12-25 01:47:14
问题 I have several thousand eBooks named like AuthorFirstName AuthorLastName Title XX.pdf , where xx are number from 1-99 (volume number). Author tilte name can be of multiple word so here i want to move copy the files to folder with the name AuthorFirstName AuthorLastName title . Everything except the number should be the folder name, so that all volumes of the eBook come in same folder. For example root.....>AuthorFirstName AuthorLastName Title>AuthorFirstName AuthorLastName Title XX.pdf 回答1:

Getting correct default save name and save directory with spaces in VBA

元气小坏坏 提交于 2019-12-24 19:27:53
问题 I have a lot of excel templates with varying names. One of them is called griep-weerstand v4.xlsb . But my question is about all the templates. I want to integrate the filename into a save script which sets the default save directory and default save name. Both have spaces in the name. After adding the correct number of quotes, the default save directory is set correctly, however, I keep struggling with adding the workbookname to the script. I tried several things and none of them has worked

opening a file with an accented character in its name, in Python 2 on Windows

拟墨画扇 提交于 2019-12-24 19:24:32
问题 In a directory in Windows I have 2 files, both of them with an accented character in its name: t1û.fn and t2ű.fn ; The dir command in the Command Prompt shows both correctly: S:\p>dir t*.fn Volume in drive S is q Volume Serial Number is 05A0-8823 Directory of S:\p 2017-09-03 14:54 4 t1û.fn 2017-09-03 14:54 4 t2ű.fn 2 File(s) 8 bytes 0 Dir(s) 19,110,621,184 bytes free Screenshot: However, Python can't see both files: S:\p>python -c "import os; print [(fn, os.path.isfile(fn)) for fn in os

Get $_FILES temp name (of the binary file)

人盡茶涼 提交于 2019-12-24 19:01:33
问题 i'm in trouble this is an example of $_FILES['file']['tmp_name'] /Applications/XAMPP/xamppfiles/temp/phpjCag18 i would like to get the temp binary filename so in this case phpjCag18 Is there anyway to get it from the $_FILES[] ? Ho to get it clean from path ? 回答1: If I understand you correctly: basename($_FILES['file']['tmp_name']) 回答2: You can use basename() for this purpose. $tmp = $_FILES['file']['tmp_name']; echo basename( $tmp ); Or, if you're trying to get the extension, use pathinfo():

Set mtime based on date string in filename

旧巷老猫 提交于 2019-12-24 13:26:01
问题 Given a group of files with the following naming convention: datetime_restofname.txt an example of which would be: 200906290700_somewordorphrase.txt how could I batch change the mtime of the files to match the date and time in the filename? 回答1: $ for f in *.txt; do touch -t `echo $f | cut -f1 -d _` "$f"; done This will set the file modtime to the date string before the underscore. 来源: https://stackoverflow.com/questions/1066690/set-mtime-based-on-date-string-in-filename