Upload mutiple_caching_latent.ipynb
Browse files- mutiple_caching_latent.ipynb +356 -0
mutiple_caching_latent.ipynb
ADDED
@@ -0,0 +1,356 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "markdown",
|
5 |
+
"id": "98d41525-a191-4a82-a1d2-9caabdf97dd8",
|
6 |
+
"metadata": {},
|
7 |
+
"source": [
|
8 |
+
"# 分散到三个目录"
|
9 |
+
]
|
10 |
+
},
|
11 |
+
{
|
12 |
+
"cell_type": "code",
|
13 |
+
"execution_count": 1,
|
14 |
+
"id": "b775bb87-1ee2-4b3c-ac8b-745a1d4254e1",
|
15 |
+
"metadata": {},
|
16 |
+
"outputs": [
|
17 |
+
{
|
18 |
+
"data": {
|
19 |
+
"text/plain": [
|
20 |
+
"{'/group_share/lora-scripts/train3/data/caching_latent/a': ['1_ amiya_(arknights)',\n",
|
21 |
+
" '1_ aurora_(arknights)',\n",
|
22 |
+
" '1_ blue_poison_(arknights)',\n",
|
23 |
+
" '1_ ceobe_(arknights)',\n",
|
24 |
+
" '1_ dorothy_(arknights)',\n",
|
25 |
+
" '1_ exusiai_(arknights)',\n",
|
26 |
+
" '1_ feater_(arknights)',\n",
|
27 |
+
" '1_ gavial_(arknights)',\n",
|
28 |
+
" \"1_ ho'olheyak_(arknights)\",\n",
|
29 |
+
" '1_ jessica_(arknights)',\n",
|
30 |
+
" '1_ la_pluma_(summer_flowers)_(arknights)',\n",
|
31 |
+
" '1_ ling_(arknights)',\n",
|
32 |
+
" '1_ mountain_(arknights)',\n",
|
33 |
+
" '1_ mudrock_(silent_night)_(arknights)',\n",
|
34 |
+
" '1_ nearl_(arknights)',\n",
|
35 |
+
" '1_ originium_arts_(arknights)',\n",
|
36 |
+
" '1_ platinum_(arknights)',\n",
|
37 |
+
" '1_ projekt_red_(arknights)',\n",
|
38 |
+
" '1_ rhodes_island_logo_(arknights)',\n",
|
39 |
+
" '1_ saga_(arknights)',\n",
|
40 |
+
" '1_ schwarz_(arknights)',\n",
|
41 |
+
" '1_ skadi_(elite_ii)_(arknights)',\n",
|
42 |
+
" '1_ specter_(arknights)',\n",
|
43 |
+
" '1_ surtr_(colorful_wonderland)_(arknights)',\n",
|
44 |
+
" '1_ suzuran_(arknights)',\n",
|
45 |
+
" '1_ texas_(arknights)',\n",
|
46 |
+
" '1_ tomimi_(arknights)',\n",
|
47 |
+
" '1_ virtuosa_(arknights)',\n",
|
48 |
+
" '1_mizuki_(arknights)',\n",
|
49 |
+
" '20_ absinthe_(arknights)',\n",
|
50 |
+
" '20_ angelina_(summer_flower)_(arknights)',\n",
|
51 |
+
" '20_ beanstalk_(arknights)',\n",
|
52 |
+
" '20_ ceobe_(unfettered)_(arknights)',\n",
|
53 |
+
" '20_ choshanland_plushy_(arknights)',\n",
|
54 |
+
" '20_ dusk_(everything_is_a_miracle)_(arknights)',\n",
|
55 |
+
" '20_ fartooth_(arknights)',\n",
|
56 |
+
" '20_ frostnova_(arknights)',\n",
|
57 |
+
" '20_ grani_(arknights)',\n",
|
58 |
+
" '20_ horn_(arknights)',\n",
|
59 |
+
" '20_ istina_(arknights)',\n",
|
60 |
+
" '20_ lappland_(refined_horrormare)_(arknights)',\n",
|
61 |
+
" '20_ meteor_(arknights)',\n",
|
62 |
+
" '20_ nearl_the_radiant_knight_(arknights)',\n",
|
63 |
+
" '20_ perfumer_(arknights)',\n",
|
64 |
+
" '20_ reed_the_flame_shadow_(arknights)',\n",
|
65 |
+
" '20_ shamare_(arknights)',\n",
|
66 |
+
" '20_ sideroca_(light_breeze)_(arknights)',\n",
|
67 |
+
" '20_ skyfire_(arknights)',\n",
|
68 |
+
" '20_ suzuran_(yukibare)_(arknights)',\n",
|
69 |
+
" '20_ typhon_(arknights)',\n",
|
70 |
+
" '20_ viviana_(arknights)',\n",
|
71 |
+
" '20_ whisperain_(arknights)',\n",
|
72 |
+
" '20_la_pluma_(arknights)_new',\n",
|
73 |
+
" '40_ ambriel_(arknights)',\n",
|
74 |
+
" '40_ andreana_(arknights)',\n",
|
75 |
+
" '40_ asbestos_(arknights)',\n",
|
76 |
+
" '40_ beanstalk_(gift_uncompleted)_(arknights)',\n",
|
77 |
+
" '40_ carnelian_(shimmering_dew)_(arknights)',\n",
|
78 |
+
" \"40_ ch'en_the_holungday_(elite_ii)_(arknights)\",\n",
|
79 |
+
" '40_ dobermann_(arknights)',\n",
|
80 |
+
" '40_ eyjafjalla_the_hvit_aska_(arknights)',\n",
|
81 |
+
" '40_ flamebringer_(arknights)',\n",
|
82 |
+
" '40_ gravel_(modeling_night)_(arknights)',\n",
|
83 |
+
" '40_ hibiscus_(arknights)',\n",
|
84 |
+
" '40_ hoshiguma_(ronin_huntress)_(arknights)',\n",
|
85 |
+
" '40_ jaye_(arknights)',\n",
|
86 |
+
" '40_ kroos_the_keen_glint_(arknights)',\n",
|
87 |
+
" '40_ leizi_(arknights)',\n",
|
88 |
+
" '40_ mayer_(arknights)',\n",
|
89 |
+
" \"40_ meteor_(bard's_holiday)_(arknights)\",\n",
|
90 |
+
" '40_ mon3tr_(arknights)',\n",
|
91 |
+
" '40_ mousse_(arknights)',\n",
|
92 |
+
" '40_ penance_(occasionally_flushed)_(arknights)',\n",
|
93 |
+
" '40_ pinecone_(sing_a_song)_(arknights)',\n",
|
94 |
+
" '40_ pozyomka_(snowy_plains_in_words)_(arknights)',\n",
|
95 |
+
" '40_ rockrock_(arknights)',\n",
|
96 |
+
" '40_ savage_(arknights)',\n",
|
97 |
+
" '40_ shining_(silent_night)_(arknights)',\n",
|
98 |
+
" '40_ sora_(arknights)',\n",
|
99 |
+
" '40_ talulah_(arknights)',\n",
|
100 |
+
" '40_ tuye_(arknights)',\n",
|
101 |
+
" '40_ waai_fu_(arknights)'],\n",
|
102 |
+
" '/group_share/lora-scripts/train3/data/caching_latent/b': ['1_ angelina_(arknights)',\n",
|
103 |
+
" '1_ bagpipe_(arknights)',\n",
|
104 |
+
" '1_ blue_poison_(shoal_beat)_(arknights)',\n",
|
105 |
+
" \"1_ ch'en_(arknights)\",\n",
|
106 |
+
" '1_ dusk_(arknights)',\n",
|
107 |
+
" '1_ eyjafjalla_(arknights)',\n",
|
108 |
+
" '1_ fiammetta_(arknights)',\n",
|
109 |
+
" '1_ goldenglow_(arknights)',\n",
|
110 |
+
" '1_ hoshiguma_(arknights)',\n",
|
111 |
+
" \"1_ kal'tsit_(arknights)\",\n",
|
112 |
+
" '1_ lappland_(arknights)',\n",
|
113 |
+
" '1_ magallan_(arknights)',\n",
|
114 |
+
" '1_ mudrock_(arknights)',\n",
|
115 |
+
" '1_ muelsyse_(arknights)',\n",
|
116 |
+
" '1_ nian_(arknights)',\n",
|
117 |
+
" '1_ penance_(arknights)',\n",
|
118 |
+
" '1_ pozyomka_(arknights)',\n",
|
119 |
+
" '1_ ptilopsis_(arknights)',\n",
|
120 |
+
" '1_ rosa_(arknights)',\n",
|
121 |
+
" '1_ saileach_(arknights)',\n",
|
122 |
+
" '1_ siege_(arknights)',\n",
|
123 |
+
" '1_ skadi_(waverider)_(arknights)',\n",
|
124 |
+
" '1_ specter_the_unchained_(arknights)',\n",
|
125 |
+
" '1_ surtr_(liberte_echec)_(arknights)',\n",
|
126 |
+
" '1_ suzuran_(spring_praise)_(arknights)',\n",
|
127 |
+
" '1_ texas_(willpower)_(arknights)',\n",
|
128 |
+
" '1_ utage_(arknights)',\n",
|
129 |
+
" '1_ w_(arknights)',\n",
|
130 |
+
" '1_multiple_girls',\n",
|
131 |
+
" '20_ amiya_(guard)_(arknights)',\n",
|
132 |
+
" '20_ archetto_(arknights)',\n",
|
133 |
+
" '20_ beeswax_(arknights)',\n",
|
134 |
+
" \"20_ ch'en_(ageless_afterglow)_(arknights)\",\n",
|
135 |
+
" '20_ degenbrecher_(arknights)',\n",
|
136 |
+
" '20_ elite_ii_(arknights)',\n",
|
137 |
+
" '20_ flametail_(arknights)',\n",
|
138 |
+
" '20_ gavial_the_invincible_(arknights)',\n",
|
139 |
+
" '20_ gummy_(arknights)',\n",
|
140 |
+
" '20_ ifrit_(arknights)',\n",
|
141 |
+
" '20_ kjera_(arknights)',\n",
|
142 |
+
" '20_ liskarm_(arknights)',\n",
|
143 |
+
" '20_ mudrock_(obsidian)_(arknights)',\n",
|
144 |
+
" '20_ originium_(arknights)',\n",
|
145 |
+
" '20_ plume_(arknights)',\n",
|
146 |
+
" '20_ robin_(arknights)',\n",
|
147 |
+
" '20_ shining_(arknights)',\n",
|
148 |
+
" '20_ silence_(arknights)',\n",
|
149 |
+
" \"20_ surtr's_golem_(arknights)\",\n",
|
150 |
+
" '20_ texas_(winter_messenger)_(arknights)',\n",
|
151 |
+
" '20_ vermeil_(arknights)',\n",
|
152 |
+
" '20_ warfarin_(arknights)',\n",
|
153 |
+
" '20_ zima_(arknights)',\n",
|
154 |
+
" '20_talulah_(arknights)',\n",
|
155 |
+
" '40_ amiya_(guard)_(touch_the_stars)_(arknights)',\n",
|
156 |
+
" '40_ ansel_(arknights)',\n",
|
157 |
+
" '40_ astesia_(starseeker)_(arknights)',\n",
|
158 |
+
" '40_ beeswax_(weisser_sand)_(arknights)',\n",
|
159 |
+
" '40_ ceobe_(summer_flowers)_(arknights)',\n",
|
160 |
+
" '40_ cliffheart_(arknights)',\n",
|
161 |
+
" '40_ ebenholz_(arknights)',\n",
|
162 |
+
" '40_ female_tourist_c_(arknights)',\n",
|
163 |
+
" '40_ goldenglow_(maiden_for_the_bright_night)_(arknights)',\n",
|
164 |
+
" '40_ heavyrain_(arknights)',\n",
|
165 |
+
" '40_ hibiscus_the_purifier_(arknights)',\n",
|
166 |
+
" '40_ hung_(arknights)',\n",
|
167 |
+
" '40_ jessica_the_liberated_(arknights)',\n",
|
168 |
+
" '40_ lava_(arknights)',\n",
|
169 |
+
" '40_ lumen_(arknights)',\n",
|
170 |
+
" '40_ melantha_(arknights)',\n",
|
171 |
+
" '40_ mint_(arknights)',\n",
|
172 |
+
" '40_ morte_(arknights)',\n",
|
173 |
+
" '40_ nightingale_(arknights)',\n",
|
174 |
+
" '40_ perlica_(arknights)',\n",
|
175 |
+
" '40_ platinum_(shimmering_dew)_(arknights)',\n",
|
176 |
+
" '40_ provence_(arknights)',\n",
|
177 |
+
" '40_ rope_(arknights)',\n",
|
178 |
+
" '40_ scene_(arknights)',\n",
|
179 |
+
" '40_ silverash_(arknights)',\n",
|
180 |
+
" '40_ suzuran_(lostlands_flowering)_(arknights)',\n",
|
181 |
+
" '40_ tequila_(arknights)',\n",
|
182 |
+
" '40_ utage_(disguise)_(arknights)',\n",
|
183 |
+
" '40_ whisperain_(tremble_cold)_(arknights)'],\n",
|
184 |
+
" '/group_share/lora-scripts/train3/data/caching_latent/c': ['1_ astesia_(arknights)',\n",
|
185 |
+
" '1_ blaze_(arknights)',\n",
|
186 |
+
" '1_ carnelian_(arknights)',\n",
|
187 |
+
" \"1_ ch'en_the_holungday_(arknights)\",\n",
|
188 |
+
" '1_ eunectes_(arknights)',\n",
|
189 |
+
" '1_ eyjafjalla_(summer_flower)_(arknights)',\n",
|
190 |
+
" '1_ frostleaf_(arknights)',\n",
|
191 |
+
" '1_ gravel_(arknights)',\n",
|
192 |
+
" '1_ irene_(arknights)',\n",
|
193 |
+
" '1_ la_pluma_(arknights)',\n",
|
194 |
+
" '1_ lin_(arknights)',\n",
|
195 |
+
" '1_ mostima_(arknights)',\n",
|
196 |
+
" '1_ mudrock_(elite_ii)_(arknights)',\n",
|
197 |
+
" '1_ myrtle_(arknights)',\n",
|
198 |
+
" '1_ nian_(unfettered_freedom)_(arknights)',\n",
|
199 |
+
" '1_ pinecone_(arknights)',\n",
|
200 |
+
" '1_ pramanix_(arknights)',\n",
|
201 |
+
" '1_ reed_(arknights)',\n",
|
202 |
+
" '1_ rosmontis_(arknights)',\n",
|
203 |
+
" '1_ saria_(arknights)',\n",
|
204 |
+
" '1_ skadi_(arknights)',\n",
|
205 |
+
" '1_ skadi_the_corrupting_heart_(arknights)',\n",
|
206 |
+
" '1_ surtr_(arknights)',\n",
|
207 |
+
" '1_ sussurro_(arknights)',\n",
|
208 |
+
" '1_ swire_(arknights)',\n",
|
209 |
+
" '1_ texas_the_omertosa_(arknights)',\n",
|
210 |
+
" '1_ utage_(summer_flowers)_(arknights)',\n",
|
211 |
+
" '1_ whislash_(arknights)',\n",
|
212 |
+
" '1_shu_(arknights)',\n",
|
213 |
+
" '20_ angelina_(distinguished_visitor)_(arknights)',\n",
|
214 |
+
" '20_ bagpipe_(queen_no._1)_(arknights)',\n",
|
215 |
+
" '20_ blemishine_(arknights)',\n",
|
216 |
+
" '20_ chong_yue_(arknights)',\n",
|
217 |
+
" '20_ doctor_(arknights)',\n",
|
218 |
+
" '20_ eunectes_(forgemaster)_(arknights)',\n",
|
219 |
+
" '20_ franka_(arknights)',\n",
|
220 |
+
" '20_ gladiia_(arknights)',\n",
|
221 |
+
" '20_ harmonie_(arknights)',\n",
|
222 |
+
" '20_ indigo_(arknights)',\n",
|
223 |
+
" '20_ kroos_(arknights)',\n",
|
224 |
+
" '20_ manticore_(arknights)',\n",
|
225 |
+
" '20_ mulberry_(arknights)',\n",
|
226 |
+
" '20_ pallas_(arknights)',\n",
|
227 |
+
" '20_ projekt_red_(light_breeze)_(arknights)',\n",
|
228 |
+
" '20_ saria_(the_law)_(arknights)',\n",
|
229 |
+
" '20_ sideroca_(arknights)',\n",
|
230 |
+
" '20_ skadi_the_corrupting_heart_(sublimation)_(arknights)',\n",
|
231 |
+
" '20_ sussurro_(summer_flower)_(arknights)',\n",
|
232 |
+
" '20_ thorns_(arknights)',\n",
|
233 |
+
" '20_ vigna_(arknights)',\n",
|
234 |
+
" '20_ weedy_(arknights)',\n",
|
235 |
+
" '20_blue_poison_(arknights)_new',\n",
|
236 |
+
" '20_theresa_(arknights)',\n",
|
237 |
+
" '40_ amiya_(newsgirl)_(arknights)',\n",
|
238 |
+
" '40_ april_(arknights)',\n",
|
239 |
+
" '40_ aurora_(elite_ii)_(arknights)',\n",
|
240 |
+
" '40_ cardigan_(arknights)',\n",
|
241 |
+
" '40_ ceylon_(arknights)',\n",
|
242 |
+
" '40_ croissant_(arknights)',\n",
|
243 |
+
" '40_ executor_(arknights)',\n",
|
244 |
+
" '40_ firewatch_(arknights)',\n",
|
245 |
+
" '40_ goldenglow_(summer_flowers)_(arknights)',\n",
|
246 |
+
" '40_ heidi_(arknights)',\n",
|
247 |
+
" '40_ highmore_(arknights)',\n",
|
248 |
+
" '40_ irene_(voyage_of_feathers)_(arknights)',\n",
|
249 |
+
" '40_ kirin_r_yato_(arknights)',\n",
|
250 |
+
" '40_ lee_(arknights)',\n",
|
251 |
+
" '40_ matterhorn_(arknights)',\n",
|
252 |
+
" '40_ metal_crab_(arknights)',\n",
|
253 |
+
" '40_ mlynar_(arknights)',\n",
|
254 |
+
" '40_ mostima_(spellbreaker)_(arknights)',\n",
|
255 |
+
" '40_ passenger_(arknights)',\n",
|
256 |
+
" '40_ phantom_(arknights)',\n",
|
257 |
+
" '40_ podenco_(arknights)',\n",
|
258 |
+
" '40_ roberta_(arknights)',\n",
|
259 |
+
" '40_ rosa_(masterpiece)_(arknights)',\n",
|
260 |
+
" '40_ shaw_(arknights)',\n",
|
261 |
+
" '40_ snowsant_(arknights)',\n",
|
262 |
+
" '40_ swire_the_elegant_wit_(arknights)',\n",
|
263 |
+
" '40_ tomimi_(silent_night)_(arknights)',\n",
|
264 |
+
" '40_ w_(wanted)_(arknights)',\n",
|
265 |
+
" '40_ines_(arknights)']}"
|
266 |
+
]
|
267 |
+
},
|
268 |
+
"execution_count": 1,
|
269 |
+
"metadata": {},
|
270 |
+
"output_type": "execute_result"
|
271 |
+
}
|
272 |
+
],
|
273 |
+
"source": [
|
274 |
+
"import os\n",
|
275 |
+
"import shutil\n",
|
276 |
+
"\n",
|
277 |
+
"# Define the source directory and target directories\n",
|
278 |
+
"source_dir = '/group_share/lora-scripts/train3/data/arknight_0525'\n",
|
279 |
+
"target_dirs = ['/group_share/lora-scripts/train3/data/caching_latent/a', '/group_share/lora-scripts/train3/data/caching_latent/b', '/group_share/lora-scripts/train3/data/caching_latent/c']\n",
|
280 |
+
"\n",
|
281 |
+
"# Create the target directories if they do not exist\n",
|
282 |
+
"for target_dir in target_dirs:\n",
|
283 |
+
" os.makedirs(target_dir, exist_ok=True)\n",
|
284 |
+
"\n",
|
285 |
+
"# List all directories in the source directory\n",
|
286 |
+
"directories = [d for d in os.listdir(source_dir) if os.path.isdir(os.path.join(source_dir, d))]\n",
|
287 |
+
"\n",
|
288 |
+
"# Group directories in sets of three and distribute them to target directories\n",
|
289 |
+
"for i, directory in enumerate(directories):\n",
|
290 |
+
" target_dir = target_dirs[i % len(target_dirs)]\n",
|
291 |
+
" source_path = os.path.join(source_dir, directory)\n",
|
292 |
+
" target_path = os.path.join(target_dir, directory)\n",
|
293 |
+
" shutil.move(source_path, target_path)\n",
|
294 |
+
"\n",
|
295 |
+
"# Verify the result by listing the contents of each target directory\n",
|
296 |
+
"result = {target_dir: os.listdir(target_dir) for target_dir in target_dirs}\n",
|
297 |
+
"result"
|
298 |
+
]
|
299 |
+
},
|
300 |
+
{
|
301 |
+
"cell_type": "markdown",
|
302 |
+
"id": "08c84aa8-553a-44d4-846f-2d6b5c78faa4",
|
303 |
+
"metadata": {},
|
304 |
+
"source": [
|
305 |
+
"# 移回原来的目录"
|
306 |
+
]
|
307 |
+
},
|
308 |
+
{
|
309 |
+
"cell_type": "code",
|
310 |
+
"execution_count": null,
|
311 |
+
"id": "1a19da33-a094-4f8e-8b25-32a697b9b993",
|
312 |
+
"metadata": {},
|
313 |
+
"outputs": [],
|
314 |
+
"source": [
|
315 |
+
"import os\n",
|
316 |
+
"import shutil\n",
|
317 |
+
"\n",
|
318 |
+
"# Define the source directory and target directories\n",
|
319 |
+
"source_dir = '/mnt/data/source'\n",
|
320 |
+
"target_dirs = ['/mnt/data/root/a', '/mnt/data/root/b', '/mnt/data/root/c']\n",
|
321 |
+
"\n",
|
322 |
+
"# Move the directories back to the source directory\n",
|
323 |
+
"for target_dir in target_dirs:\n",
|
324 |
+
" for item in os.listdir(target_dir):\n",
|
325 |
+
" source_path = os.path.join(target_dir, item)\n",
|
326 |
+
" target_path = os.path.join(source_dir, item)\n",
|
327 |
+
" shutil.move(source_path, target_path)\n",
|
328 |
+
"\n",
|
329 |
+
"# Verify the result by listing the contents of the source directory\n",
|
330 |
+
"result = os.listdir(source_dir)\n",
|
331 |
+
"result\n"
|
332 |
+
]
|
333 |
+
}
|
334 |
+
],
|
335 |
+
"metadata": {
|
336 |
+
"kernelspec": {
|
337 |
+
"display_name": "Python 3 (ipykernel)",
|
338 |
+
"language": "python",
|
339 |
+
"name": "python3"
|
340 |
+
},
|
341 |
+
"language_info": {
|
342 |
+
"codemirror_mode": {
|
343 |
+
"name": "ipython",
|
344 |
+
"version": 3
|
345 |
+
},
|
346 |
+
"file_extension": ".py",
|
347 |
+
"mimetype": "text/x-python",
|
348 |
+
"name": "python",
|
349 |
+
"nbconvert_exporter": "python",
|
350 |
+
"pygments_lexer": "ipython3",
|
351 |
+
"version": "3.8.10"
|
352 |
+
}
|
353 |
+
},
|
354 |
+
"nbformat": 4,
|
355 |
+
"nbformat_minor": 5
|
356 |
+
}
|