file-extension

Renaming file extension in batch

旧街凉风 提交于 2020-01-17 02:37:11
问题 I've got a few files like this: I'm wanting to change them all to *.gz This is the code I've written to try to change the file extensions: ren *.dat.gz.gz.gz.gz *.gz But this doesn't do anything. Thanks. 回答1: ren ????????.dat.gz.* ????????.gz or, if the .dat part is needed ren ????????.dat.gz.* ????????.dat.gz 回答2: Try this: @echo off setlocal enabledelayedexpansion for %%a in (*.gz) do ( set "file=%%a" set "file=!file:.gz.gz.gz=!" echo ren "%%~nxa" "!file!" ) Run it from the location of the

Adding extension to multiple files (Python3.5)

我只是一个虾纸丫 提交于 2020-01-04 09:22:08
问题 I have a bunch of files that do not have an extension to them. file needs to be file.txt I have tried different methods (didn't try the complicated ones since I am just learning to do a bit of advanced python). here is one that I tried: import os pth = 'B:\\etc' os.chdir(pth) for files in os.listdir('.'): changeName = 'files{ext}'.format(ext='.txt') I tried the append, replace and rename methods as well and it didn't work for me. or those don't work in the 1st place with what I am trying to

Java getting file extension without substring

强颜欢笑 提交于 2020-01-03 09:57:49
问题 How do I get file extension in Java without using that silly lastIndexOf('.') etc.? 回答1: The apache Commons library has FilenameUtils.getExtension(). You can look over the source starting here, and FilenameUtils. At least look over their implementation. It's pretty simple, they handle dir.ext/file correctly, and to handle something like file.tar.gz you'll need a special case if you want to extract .tar.gz rather than just .gz . 回答2: That's probably the easiest way (also note that depending on

Why does Android aapt remove .gz file extension of assets?

点点圈 提交于 2020-01-03 09:19:22
问题 When I add a GZIP-ed file to my Android project's assets, the ".gz" extension is stripped when the project is packaged. (So, for instance, "foo.gz" in my assets folder needs to be accessed in code using getAssets().open("foo") .) This doesn't seem to happen with other extensions (e.g., ".html") that I'm using. The asset is still GZIP-ed (I have to wrap the input stream in a GZIPInputStream to read it). Is this standard behavior or a bug? If it's standard, is there any documentation about

JSON File Extension

蓝咒 提交于 2020-01-01 04:52:09
问题 I've been saving all my json files with .txt extension and they worked with jquery ajax calls. When I change the extension to .json and in my jquery ajax call -- jQuery.ajax() -- I specify dataType: "json", contentType: "application/json; charset=utf-8", the files no longer work. Why so? Shouldn't all json files have an extension .json? I'm using IIS server. JSON { "rows": [ {"row":[ {"cells": [ {"data": "Edit"}, {"data": "030194"} ]} ]}, {"row":[ {"cells": [ {"data": "Add"}, {"data": "030194

Eclipse plug-in: Create a new file extension for a language not supported by Eclipse

牧云@^-^@ 提交于 2019-12-29 14:49:46
问题 I am creating an Eclipse plug-in for it to support a new language. The problem I have is with the content type/file association and its respective editor. The language has no base in Java or XML and let's say its extension is ' .xyz ' From what I understood of research online, I would need to create a new Content Type with file extension ' .xyz '. But all the information I have found online has related to either associating a new extension with java (for java syntax highlighting) or creating

Associate file type with Java Swing application

巧了我就是萌 提交于 2019-12-29 00:38:48
问题 I am creating a java swing application and I need to set the my program as the default program for the file extension .mcsd (MIME type text/mcsd ). This must work on windows, and it would be nice if it worked on OS X/Linux as well. I am somewhat new to java (3 or 4 months) so please don't bombard me with all kinds of expert talk. I have seen associating a custom file extension with java app in windows, but I would prefer not to use the Java Web Start. If possible, I would also like to know

ASP.NET MVC - Routing - an action with file extension

谁说我不能喝 提交于 2019-12-28 03:02:09
问题 is there a way to achieve calling URL http://mywebsite/myarea/mycontroller/myaction.xml This would basically "fake" requesting a file but the result would be an action operation that would serve a file created dynamically? I tried this: context.MapRoute( "Xml_filename", "Xml/{controller}/{action}.xml" ); but whenever there is a filextension in the URL the routing fails and behaves as I was requesting a file directly. I suspect this might be because of using extension less url handler. <add

Grouping file extensions for re-writing URL's [.htaccess]

痞子三分冷 提交于 2019-12-25 05:32:28
问题 How can I group these two together; is it like ".(html|php)$" - please provide the code. Note, the answer should work for all file extensions: what is your thoughts on removing every file extension; comment on the code used - as it is rare to find. RewriteCond %{THE_REQUEST} ^GET\ (.*)\.html\ HTTP RewriteRule (.*)\.html$ $1 [R=301] RewriteCond %{REQUEST_FILENAME}.html -f RewriteCond %{REQUEST_URI} !/$ RewriteRule (.*) $1\.html [L] RewriteCond %{THE_REQUEST} ^GET\ (.*)\.php\ HTTP RewriteRule (

Remove file extension with .htaccess: Error with trailing slash

限于喜欢 提交于 2019-12-25 04:06:12
问题 I want to remove the file extension like .html from my websites with .htaccess. The final structure should be like so: http://domain.com/file --> http://domain.com/file.html http://domain.com/file/ --> http://domain.com/file.html With my existing code in .htaccess I'll get "Internal Server Error" on my Browser when there's a trailing slash at the end. What can I do? Thanks! RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(.*)$ $1.html