Rename files without extension with AutoHotkey - file-io

I am trying to add .pdf to the filename of files without extension in a folder.
It is possible to rename for example txt files to pdf using the following command:
FileMove, %SourceFolder%\*.txt, %SourceFolder%\*.pdf
Also, I can add .pdf to all files by:
FileMove, %SourceFolder%\*, %SourceFolder%\*.pdf
But I only want to target only the files without extension. How to do this?

Example
As suggested by kasper and MCL
SetWorkingDir %A_ScriptDir%
Loop, files\*
{
if !StrLen(A_LoopFileExt) ; if no file extension
{
FileMove,%A_LoopFileFullPath%,%A_LoopFileFullPath%.pdf ;rename file
}
}
see [Loop, FilePattern]
see [FileMove]

#kasper, You can use windows command prompt to rename the file as well as change the extension.
Just navigate to the file directory and use command
ren abc.txt abc.pdf
Here abc.txt is old file and abc.pdf is pdf of abc.txt.

Related

make: Convert .pdf files in a folder to .txt files without using loops

I want to convert all .pdf files in a folder into .txt files with make without using loops and with the help of pdftotext. The new .txt files shall keep the original file name. Additionally, the new file gets a new file extension.
Example:
test1.pdf --> test2.newextension
Everything's written within a Makefile file. I start the conversion by typing in "make converted" in my console.
My first (miserable) attempt was:
converted:
#ls *.pdf | -n1 pdftotext
However, there are 3 things still missing with it:
It doesn't repeat the process
The new file extension isn't being added to the newly created files.
Is the original name being kept or being given to the pdftotext function?
I used to program with the bash and Makefile is completely new to me. I'd be thankful for answers!
You can refer to this simple example:
SOURCES ?= $(wildcard *.pdf)
%.txt: %.pdf
pdftotext $< $#
all: $(SOURCES:%.pdf=%.txt)
clean:
rm -f *.txt
If no SOURCE was defined, it'll just try to get all *.pdf files from the local directory.
Then we define a pattern rule teaching make how to make *.txt out of *.pdf.
We also define target all that tried to make a txt file for each .pdf file in SOURCES variable.
And also a clean rule deleting quietly all .txt files in current dir (hence be careful, potentially dangerous).

can't download file with scp- no error but the file don't download

I'm trying to download a file using scp
I run
scp user#ip:/home/user/file.gzip $HOME/Desktop
I get
file.gzip 100% 156MB 155.8MB/s 00:01
but the file is not found
I tried on Ubuntu and Windows and the results is the same. And I tried with another destiny folder, but the file don't found.
Please I appreciate any help
Using that syntax, scp will attempt to save the file with the name 'Desktop'
Instead, save it inside your home folder by specifying a filename explicitly:
scp user#ip:/home/user/file.gzip $HOME/file.gzip
Or, to preserve the original filename and save inside your 'Desktop' folder, append forward slash period:
scp user#ip:/home/user/file.gzip $HOME/Desktop/.

Bash rename files in folder by stripping out characters

I am running ubuntu and I have little experience with sed and awk.
I would like to rename files with the following:
ITIS50V_PHYS_LANDFORM_ARTIFIC_EXP_Areal_2014_09.shp
ITIS50V_LCLU_LANDCOVER_EXP_2014_03.dbf
ITIS50V_CULT_INDUSTRIAL_EXP_Linear_2014_02.shx
I would like to rename them to :
ITIS50V_PHYS_LANDFORM_ARTIFIC.shp
ITIS50V_LCLU_LANDCOVER.dbf
ITIS50V_CULT_INDUSTRIAL.shx
For renaming files, you could simply use the rename utility.
rename 's/_EXP_.*?(?=.[^.]*$)//' *.*
Try the above command on the directory where the files you want to rename are located.

Trying to create .htaccess file using ftp doesn't work

I want to create a .htaccess file in a specific directory. I'm using Notepad++ and their plug-in for FTP (NppFTP). I'm able to create any other files and see them in the folder but when I try to create a .htaccess I don't see that file in the directory. I get no errors, it is like nothing happened.
I tried to create this file using an FTP program and it showed the file and right away it disappeared. My guess it is because this is a special file used by the system and prefixed by a (.)
What is a way to edit that file?
This is probably because your ".htaccess" file is a hidden file and your system is set up to no display hidden files.
Have a look in your Notepad++ settings if there's an option to make hidden files visible/unhide.
In addition to that check the windows folder options for that option!
switch on showing hidden files in your ftp client

how to use DEXtoJar

I find the solution to decompile a file dex to jar from this link http://code.google.com/p/dex2jar/downloads/list but i don't understand how to use it.
Follow the below steps to do so_
Rename your APK file(e.g., rename your APK file to .zip Ex- test.apk -> test.zip) & extract resultant zip file.
Copy your .dex file in to dex2jar folder.
Run setclasspath.bat. This should be run because this data is used in the next step.
Go to Windows Command prompt, change the folder path to the path of your dex2jar folder and run the command as follows:
d2j-dex2jar.bat classes.dex
enjoy!! Your jar file will be ready in the same folder with name classes_dex2jar.jar.
Hope this helps you and All reading this... :)
Download dex2jar https://code.google.com/p/dex2jar/downloads/list
Run dex2jar on apk d2j-dex2jar.sh someApk.apk
open jar file in JD GUI http://jd.benow.ca/
Follow this guide: https://code.google.com/p/dex2jar/wiki/UserGuide
--Update 10/11/2016--
Found this ClassyShark from Google's github pretty easy to view code from APK.
https://github.com/google/android-classyshark
// make sure that you downloaded release https://github.com/pxb1988/dex2jar/releases (for the ppl who coldnt find this link in /dex2jar/downloads/list
Step 1 extract the contents of dex2jar.*.*.zip file
Step 2 copy your .dex file to the extracted directory
Step 3 execute dex2jar.bat <.dex filename> on windows, or ./dex2jar.sh <.dex filename> on linux
Simple way
Rename your test.apk => test.zip
Extract test.zip then open that folder
Download dex2jax & Extract
Copy classes.dex file from test folder
Past to dex2jar Extracted folder
if use windows press Alt & D keys then type cmd press Enter(open to cmd)
run the command d2j-dex2jar.bat classes.dex
Download JD-GUI
Move classes-dex2jar.jar file to JD-GUI
Everything Done..
old link
the link http://code.google.com/p/dex2jar/downloads/list is old, it will redirect to https://github.com/pxb1988/dex2jar
dex2jar syntax
in https://github.com/pxb1988/dex2jar, you can see your expected usage/syntax:
sh d2j-dex2jar.sh -f ~/path/to/apk_to_decompile.apk
can convert from apk to jar.
want dex to jar
if you have dex file (eg. using FDex2 dump from a running android apk/app), then you can:
sh d2j-dex2jar.sh -f ~/path/to/dex_to_decompile.dex
can got the converted jar from dex.
example:
/xxx/dex-tools-2.1-SNAPSHOT/d2j-dex2jar.sh -f com.huili.readingclub8825612.dex
dex2jar com.huili.readingclub8825612.dex -> ./com.huili.readingclub8825612-dex2jar.jar
want jar to java src
if you continue want convert from jar to java sourcecode, then you, have multiple choice:
using Jadx directly convert dex to java sourcecode
first convert dex to jar, second convertjartojava sourcecode`
Note
how to got d2j-dex2jar.sh?
download from dex2jar github release, got dex-tools-2.1-SNAPSHOT.zip, unzip then got
you expected Linux's d2j-dex2jar.sh
and Windows's d2j-dex2jar.bat
and related other tools
d2j-jar2dex.sh
d2j-dex2smali.sh
d2j-baksmali.sh
d2j-apk-sign.sh
etc.
what's the full process of convert dex to java sourcecode ?
you can refer my (crifan)'s full answer in another post: android - decompiling DEX into Java sourcecode - Stack Overflow
or refer my full tutorial (but written in Chinese): 安卓应用的安全和破解
If anyone is still looking for an easy way to decompile an APK (with resource decompiling), have a look at the tools I have created: https://github.com/dirkvranckaert/AndroidDecompiler
Just checkout the project locally and run the script as documented and you'll get all the resources and sources decompiled.
You can decompile your .apk files and download online.
http://www.javadecompilers.com/
Download latest dex2jar from here -> dex2jar
Run this command on linux -> sh d2j-dex2jar.sh classes.dex
Download java decompiler from here - > JD-GUI
Drag and drop the classes-dex2jar.jar file to JD-GUI
If you're looking for the version for windows get it from source forge:
https://sourceforge.net/projects/dex2jar/
It has the d2j-dex2jar.bat file you need
Download Dex2jar and Extract it.
Go to Download path
./d2j-dex2jar.sh /path-to-your/someApk.apk
if .sh is not compilable, update the permission: chmod a+x d2j-dex2jar.sh.
It will generate .jar file.
Now use the jar with JD-GUI to decompile it
After you extract the classes.dex file, just drag and drop it to d2j-dex2jar
Can be used as follow:
Download dex2jar here and extract it.
Download Java decompiler here (If you want to investigate .class file)
Get you release .apk file and change its extension with .zip
Extract .zip and find the classes.dex and classes2.dex
Paste these files into dex2jar folder where .bat file exist of dex2jar (normally names as d2j-dex2jar)
From dex2jar folder, open cmd [Shift+right click to see option to open cmd/power shell]
Type the command in cmd: d2j-dex2jar release.apk
You will get the .class file, open this file into Java Decompiler.
The below url is doing same as above answers. Instead of downloading some jar files and doing much activities, you can try to decompile by:
http://apk-deguard.com/