Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Laisky committed Feb 25, 2021
1 parent 6385d82 commit 1c4908e
Showing 1 changed file with 58 additions and 1 deletion.
59 changes: 58 additions & 1 deletion py3/twitter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,63 @@
"\n",
"# download_relate_tweets()\n"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
"# rename download entities\n",
"from os import rename, walk\n",
"from pathlib import Path\n",
"from shutil import copyfile\n",
"\n",
"\n",
"dst_dir = r'/root/images/'\n",
"srcs = [\n",
"r'/mnt/c/Users/ppcel/Downloads/twitter-2021-01-30-171d328c51ae57206ad8ceb533c4e435c9a6b4ca7ec37f3441d01ab1d4f64cd2/data/tweet_media/',\n",
"r'/mnt/c/Users/ppcel/Downloads/twitter-2021-01-30-171d328c51ae57206ad8ceb533c4e435c9a6b4ca7ec37f3441d01ab1d4f64cd2/data/moments_tweets_media/', \n",
"]\n",
"\n",
"for srcpath in srcs:\n",
" for root, dirs, files in walk(srcpath):\n",
" for f in files:\n",
" old_fpath = Path(root, f).absolute()\n",
" new_fpath = Path(dst_dir, f.split('-', 1)[1]).absolute()\n",
" # rename(old_fpath, new_fpath)\n",
" copyfile(old_fpath, new_fpath)\n",
" \n"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"PosixPath('/root/repo/laisky/HelloWorld/py3/a/v')"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"r'/mnt/c/Users/ppcel/Downloads/twitter-2021-01-30-171d328c51ae57206ad8ceb533c4e435c9a6b4ca7ec37f3441d01ab1d4f64cd2/data/tweet.js/'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"''.split"
]
}
],
"metadata": {
Expand All @@ -316,7 +373,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.0"
"version": "3.8.7"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 1c4908e

Please sign in to comment.