file-extension

Add file extension to all files in a folder in R

送分小仙女□ 提交于 2019-12-12 10:57:36
问题 As a result from a loop I have a lot of files without a file extension in a folder. How could I add a file extension (.png) to all files in the folder while keeping the original name, e.g. from NAME1 to NAME1.png , NAME3 to NAME3.png , NAME6 to NAME6.png etc using R? 回答1: With the list.files function you can retrieve the file names under a given path and with a given pattern. From them you can use paste to add your file extension and next file.rename to rename the files. For instance:

How to save (all) SQL server image datatype to file system with correct file extension

心已入冬 提交于 2019-12-12 09:12:35
问题 I have different types of files in table (txt, doc, jpg, etc) and I want to save them all to my file system. I know how to do it file by file, but it's no use, I have to do a loop that saves all files with right extensions at once. Any advice? I do it this way now: DECLARE @ObjectToken INT EXEC sp_OACreate 'ADODB.Stream', @ObjectToken OUTPUT EXEC sp_OASetProperty @ObjectToken, 'Type', 1 EXEC sp_OAMethod @ObjectToken, 'Open' EXEC sp_OAMethod @ObjectToken, 'Write', NULL, <this is where binary

Is there anyway to make SOMETHING automatically add selected file extension to filename, when OPENFILENAME struct and GetSaveFileName() are used?

*爱你&永不变心* 提交于 2019-12-12 06:48:21
问题 I have this function: void PickupFileAndSave(std::vector<unsigned char> file_data, int *error_code, char *file_mask = "All files (*.*)\0*.*\0\0") { OPENFILENAMEA ofn; // common dialog box structure char szFile[MAX_PATH]; // buffer for file name char initial_dir[MAX_PATH] = { 0 }; GetStartupPath(initial_dir); // Initialize OPENFILENAME ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = GetActiveWindow(); ofn.lpstrFile = szFile; // Set lpstrFile[0] to '\0' so that

.htaccess change file extention and force to https at the same time

牧云@^-^@ 提交于 2019-12-12 03:29:19
问题 I want to change my url from .php to .html with .htaccess also, I need this page force becoming to https the above requirement are for the certain page not whole page... eg. http://domain/filename/XXX.php => https://domain/filename/XXX.html do anyone know how to solve this problem? thanks 回答1: Just combine some rules for https and extension modification # Prevent endless loop RewriteCond %{ENV:REDIRECT_STATUS} ^$ # and redirect php to html RewriteRule ^(.+)\.php$ https://%{HTTP_HOST}/$1.html

how search file with multiple criteria of extension of file

梦想与她 提交于 2019-12-11 21:37:59
问题 I have code for to search file and how to search any files with multiple extension of file searching.Like Office file {docx,pptx,xlsx,pdf} , media file{mp3,mp4,mkv,avi} , image file {jpg,png}. Thanks Code : public void SearchFile(string folder, string KeyWord, DataGridView TableName, ref Label Result, ref long Count) { string[] row; foreach (string file in Directory.GetFiles(folder, "*" + KeyWord + "*doc")) // <== Multiple Extension Searching { FileInfo fi = new FileInfo(file); double Lenght

How to output multiple file extensions stored in a .txt file on Powershell

淺唱寂寞╮ 提交于 2019-12-11 14:42:26
问题 my purpose is to output the files with the extensions that match the ones I store on a .txt file but I don't know how to make it work. The way I am trying to do now does not generate any output or output the files of the extensions that are not on the text file (Extension.txt) I indicate. How am I supposed to fix this? The content in my .txt file is: *.xlsx,*.xlsm,*.xlsb,*.xltx,*.xltm,*.xls,*.xml My current code is as followed: $fileHeaders = @('country','cDrive','dDrive') $extensions = ${C

Removing the file with same name, extension doesn't matter

走远了吗. 提交于 2019-12-11 14:08:57
问题 I have some files in "~Content/Documents" folder which holds every uploaded file. In my case the user can only upload one file. I have done the uploading part where the user can upload his file. if (file.ContentLength > 0) { var fileName = Path.GetFileName(file.FileName); var fullpath = System.Web.HttpContext.Current.Server.MapPath("~/Content/Documents"); file.SaveAs(Path.Combine(fullpath,"document"+Path.GetExtension(fileName))); } My problem is: User can upload either ".doc", ".docx", ".xls"

Recommended File Extension for rails view pages(2.3.2)

自闭症网瘾萝莉.ら 提交于 2019-12-11 13:34:19
问题 Which is the Recommended File Extension for rails view pages(2.3.2) 1.RHTML 2.html.erb any significance in this. 回答1: The standard naming: template_name.mime_type.erb Significance: The controller will look for appropriately named template file when responding to different request formats: def show @user = User.find(params[:id]) respond_to do |format| format.html # Looks for show.html.erb format.xml # this will look for show.xml.erb # OR you can always use render :xml facility # format.xml {

How to remove the word 'index' in the url [.htaccess]?

纵饮孤独 提交于 2019-12-11 12:53:16
问题 Currently, I am using the below code to remove the word 'index' in my urls - however, the issue is that it allows for two versions: one without and one with [the word] - hence, I have referenced the one without (in the HTML) - but the user still might type the one with the word. How can I completely wipe the word 'index' from the index page: http://example.com/index[.html] goes to http://example.com/index but should really go to http//:example.com RewriteCond %{REQUEST_FILENAME} !-d

Not able to get image file extension

旧街凉风 提交于 2019-12-11 09:48:26
问题 I'm using Uploadify to upload an image to the server. The image is uploaded, and placed in the temp folder of the web server. Now I need to work with the file beore moving it to it's real location, and I have the following code: // Get the filepath and filename from server temp dir $sourceFile = $_FILES[ 'Filedata' ][ 'tmp_name' ]; // e.g. c:\server\path\tmp\php159.tmp // Solution 1 for getting file extension $fileExt1 = pathinfo($sourceFile, PATHINFO_EXTENSION); // <-- This only returns .tmp